Revision: 76133
http://sourceforge.net/p/brlcad/code/76133
Author: starseeker
Date: 2020-06-12 13:44:32 +0000 (Fri, 12 Jun 2020)
Log Message:
-----------
Match the old output from burst (sans debugging messages from GRID_SHOT.) Need
to exercise more of the old code features, but it's now looking like we've
managed to refactor the code successfully.
Modified Paths:
--------------
brlcad/branches/bioh/src/burst2/burst.cpp
brlcad/branches/bioh/src/burst2/burst.h
brlcad/branches/bioh/src/burst2/grid.cpp
brlcad/branches/bioh/src/burst2/idents.cpp
brlcad/branches/bioh/src/burst2/paint.cpp
Modified: brlcad/branches/bioh/src/burst2/burst.cpp
===================================================================
--- brlcad/branches/bioh/src/burst2/burst.cpp 2020-06-12 12:54:34 UTC (rev
76132)
+++ brlcad/branches/bioh/src/burst2/burst.cpp 2020-06-12 13:44:32 UTC (rev
76133)
@@ -54,18 +54,18 @@
#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, const char *fmt, ...)
+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);
- } else {
- vfprintf(stderr, fmt, ap);
}
+ if (TYPE == MSG_OUT) {
+ vfprintf(stdout, fmt, ap);
+ }
}
/* Forward declare so we can use this function in a command
@@ -224,12 +224,12 @@
}
if (bu_opt_fastf_t(&msg, 1, &argv[1], (void *)&s->viewazim) < 0) {
- brst_log(s, "problem reading azimuth: %s\n", bu_vls_cstr(&msg));
+ 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, "problem reading elevation: %s\n", bu_vls_cstr(&msg));
+ brst_log(s, MSG_OUT, "problem reading elevation: %s\n",
bu_vls_cstr(&msg));
ret = BRLCAD_ERROR;
}
@@ -260,18 +260,18 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- printf("Usage: critical-comp-file file\n");
+ brst_log(s, MSG_OUT, "Usage: critical-comp-file file\n");
return BRLCAD_ERROR;
}
- //brst_log(s, "Reading critical component idents...\n");
+ brst_log(s, MSG_LOG, "Reading critical component idents...\n");
if (!readIdents(&s->critids, argv[1])) {
- printf("failed to open critical component file: %s\n", argv[1]);
+ brst_log(s, MSG_OUT, "failed to open critical component file: %s\n",
argv[1]);
return BRLCAD_ERROR;
}
- //brst_log(s, "Reading critical component idents... done.\n");
+ brst_log(s, MSG_LOG, "Reading critical component idents... done.\n");
bu_vls_sprintf(&s->critfile, "%s", argv[1]);
@@ -296,7 +296,7 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- brst_log(s, "Usage: deflect-spall-cone yes|no\n");
+ brst_log(s, MSG_OUT, "Usage: deflect-spall-cone yes|no\n");
return BRLCAD_ERROR;
}
@@ -304,7 +304,7 @@
int fval = bu_str_false(argv[1]);
if (!tval && !fval) {
- brst_log(s, "Invalid boolean string: %s\n", argv[1]);
+ brst_log(s, MSG_OUT, "Invalid boolean string: %s\n", argv[1]);
return BRLCAD_ERROR;
}
@@ -311,7 +311,7 @@
s->deflectcone = (fval) ? 0 : tval;
// Echo command (logCmd in original code)
- printf("%s\t%s\n", argv[0], s->deflectcone ? "yes" : "no");
+ brst_log(s, MSG_OUT, "%s\t%s\n", argv[0], s->deflectcone ? "yes" : "no");
return BRLCAD_OK;
}
@@ -330,7 +330,7 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- printf("Usage: dither-cells yes|no\n");
+ brst_log(s, MSG_OUT, "Usage: dither-cells yes|no\n");
return BRLCAD_ERROR;
}
@@ -338,7 +338,7 @@
int fval = bu_str_false(argv[1]);
if (!tval && !fval) {
- printf("Invalid boolean string: %s\n", argv[1]);
+ brst_log(s, MSG_OUT, "Invalid boolean string: %s\n", argv[1]);
return BRLCAD_ERROR;
}
@@ -345,7 +345,7 @@
s->dithercells = (fval) ? 0 : tval;
// Echo command (logCmd in original code)
- printf("%s\t\t%s\n", argv[0], s->dithercells ? "yes" : "no");
+ brst_log(s, MSG_OUT, "%s\t\t%s\n", argv[0], s->dithercells ? "yes" : "no");
return BRLCAD_OK;
}
@@ -363,7 +363,7 @@
s->firemode = FM_GRID;
// Echo command (logCmd in original code)
- printf("enclose-target\n");
+ brst_log(s, MSG_OUT, "enclose-target\n");
return BRLCAD_OK;
}
@@ -384,32 +384,32 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 5) {
- printf("Usage: enclose-portion left right bottom top\n");
+ 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) {
- printf("problem reading left border of grid: %s\n", bu_vls_cstr(&msg));
+ 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) {
- printf("problem reading right border of grid: %s\n", bu_vls_cstr(&msg));
+ 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) {
- printf("problem reading bottom border of grid: %s\n",
bu_vls_cstr(&msg));
+ 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) {
- printf("problem reading top border of grid: %s\n", bu_vls_cstr(&msg));
+ 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)
- printf("%s\t\t%g %g %g %g\n", argv[0], s->gridlf, s->gridrt, s->griddn,
s->gridup);
+ 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;
@@ -436,7 +436,7 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- printf("Usage: error-file file\n");
+ brst_log(s, MSG_OUT, "Usage: error-file file\n");
return BRLCAD_ERROR;
}
@@ -455,12 +455,12 @@
* as they are generated. */
s->errfile = fopen(argv[1], "wb");
if (!s->errfile) {
- printf("failed to open error file: %s\n", argv[1]);
+ brst_log(s, MSG_OUT, "failed to open error file: %s\n", argv[1]);
ret = BRLCAD_ERROR;
}
// Echo command (logCmd in original code)
- printf("%s\t\t%s\n", argv[0], argv[1]);
+ brst_log(s, MSG_OUT, "%s\t\t%s\n", argv[0], argv[1]);
return ret;
}
@@ -479,7 +479,7 @@
if (!s) return BRLCAD_ERROR;
if (!bu_vls_strlen(&s->gedfile)) {
- printf("Execute failed: no target file has been specified\n");
+ brst_log(s, MSG_OUT, "Execute failed: no target file has been
specified\n");
return BRLCAD_ERROR;
}
@@ -501,7 +501,7 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- printf("Usage: grid-file file\n");
+ brst_log(s, MSG_OUT, "Usage: grid-file file\n");
return BRLCAD_ERROR;
}
@@ -520,7 +520,7 @@
/* Try to open the file */
s->gridfp = fopen(argv[1], "wb");
if (!s->gridfp) {
- printf("failed to open grid file: %s\n", argv[1]);
+ brst_log(s, MSG_OUT, "failed to open grid file: %s\n", argv[1]);
ret = BRLCAD_ERROR;
}
@@ -527,7 +527,7 @@
bu_vls_sprintf(&s->gridfile, "%s", argv[1]);
// Echo command (logCmd in original code)
- printf("%s\t\t%s\n", argv[0], bu_vls_cstr(&s->gridfile));
+ brst_log(s, MSG_OUT, "%s\t\t%s\n", argv[0], bu_vls_cstr(&s->gridfile));
return ret;
}
@@ -548,7 +548,7 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2 && argc != 7) {
- printf("Usage: ground-plane no|yes height xpos xneg ypos yneg\n");
+ brst_log(s, MSG_OUT, "Usage: ground-plane no|yes height xpos xneg ypos
yneg\n");
return BRLCAD_ERROR;
}
@@ -556,7 +556,7 @@
int fval = bu_str_false(argv[1]);
if (!tval && !fval) {
- printf("Invalid boolean string: %s\n", argv[1]);
+ brst_log(s, MSG_OUT, "Invalid boolean string: %s\n", argv[1]);
return BRLCAD_ERROR;
}
@@ -564,37 +564,37 @@
if (!s->groundburst) {
// Echo command (logCmd in original code)
- printf("%s\t\tno\n", argv[0]);
+ brst_log(s, MSG_OUT, "%s\t\tno\n", argv[0]);
return ret;
}
if (bu_opt_fastf_t(&msg, 1, &argv[2], (void *)&s->grndht) < 0) {
- brst_log(s, "problem reading distance of target origin above ground
plane: %s\n", bu_vls_cstr(&msg));
+ brst_log(s, MSG_OUT, "problem reading distance of target origin above
ground plane: %s\n", bu_vls_cstr(&msg));
ret = BRLCAD_ERROR;
}
if (bu_opt_fastf_t(&msg, 1, &argv[3], (void *)&s->grndfr) < 0) {
- brst_log(s, "problem reading distance out positive X-axis of target to
edge: %s\n", bu_vls_cstr(&msg));
+ brst_log(s, MSG_OUT, "problem reading distance out positive X-axis of
target to edge: %s\n", bu_vls_cstr(&msg));
ret = BRLCAD_ERROR;
}
if (bu_opt_fastf_t(&msg, 1, &argv[4], (void *)&s->grndbk) < 0) {
- brst_log(s, "problem reading distance out negative X-axis of target to
edge: %s\n", bu_vls_cstr(&msg));
+ brst_log(s, MSG_OUT, "problem reading distance out negative X-axis of
target to edge: %s\n", bu_vls_cstr(&msg));
ret = BRLCAD_ERROR;
}
if (bu_opt_fastf_t(&msg, 1, &argv[5], (void *)&s->grndlf) < 0) {
- brst_log(s, "problem reading distance out positive Y-axis of target to
edge: %s\n", bu_vls_cstr(&msg));
+ brst_log(s, MSG_OUT, "problem reading distance out positive Y-axis of
target to edge: %s\n", bu_vls_cstr(&msg));
ret = BRLCAD_ERROR;
}
if (bu_opt_fastf_t(&msg, 1, &argv[6], (void *)&s->grndrt) < 0) {
- brst_log(s, "problem reading distance out negative Y-axis of target to
edge: %s\n", bu_vls_cstr(&msg));
+ brst_log(s, MSG_OUT, "problem reading distance out negative Y-axis of
target to edge: %s\n", bu_vls_cstr(&msg));
ret = BRLCAD_ERROR;
}
// Echo command (logCmd in original code)
- printf("%s\t\tyes %g %g %g %g %g\n", argv[0], s->grndht, s->grndfr,
s->grndbk, s->grndlf, s->grndrt);
+ brst_log(s, MSG_OUT, "%s\t\tyes %g %g %g %g %g\n", argv[0], s->grndht,
s->grndfr, s->grndbk, s->grndlf, s->grndrt);
/* after printing, convert to mm */
s->grndht /= s->unitconv;
@@ -661,23 +661,23 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- printf("Usage: burst-air-file file\n");
+ brst_log(s, MSG_OUT, "Usage: burst-air-file file\n");
return BRLCAD_ERROR;
}
- //brst_log(s, "Reading burst air idents...\n");
+ brst_log(s, MSG_LOG, "Reading burst air idents...\n");
if (!readIdents(&s->airids, argv[1])) {
- printf("failed to open burst air idents file: %s\n", argv[1]);
+ brst_log(s, MSG_OUT, "failed to open burst air idents file: %s\n",
argv[1]);
return BRLCAD_ERROR;
}
- //brst_log(s, "Reading burst air idents... done.\n");
+ brst_log(s, MSG_LOG, "Reading burst air idents... done.\n");
bu_vls_sprintf(&s->airfile, "%s", argv[1]);
// Echo command (logCmd in original code)
- printf("%s\t\t%s\n", argv[0], bu_vls_cstr(&s->airfile));
+ brst_log(s, MSG_OUT, "%s\t\t%s\n", argv[0], bu_vls_cstr(&s->airfile));
return ret;
}
@@ -698,7 +698,7 @@
if (argc != 2) {
- printf("Usage: histogram-file file\n");
+ brst_log(s, MSG_OUT, "Usage: histogram-file file\n");
return BRLCAD_ERROR;
}
@@ -717,7 +717,7 @@
/* Try to open the file */
s->histfp = fopen(argv[1], "wb");
if (!s->histfp) {
- printf("failed to open histogram file: %s\n", argv[1]);
+ brst_log(s, MSG_OUT, "failed to open histogram file: %s\n", argv[1]);
ret = BRLCAD_ERROR;
}
@@ -724,7 +724,7 @@
bu_vls_sprintf(&s->histfile, "%s", argv[1]);
// Echo command (logCmd in original code)
- printf("%s\t\t%s\n", argv[0], bu_vls_cstr(&s->histfile));
+ brst_log(s, MSG_OUT, "%s\t\t%s\n", argv[0], bu_vls_cstr(&s->histfile));
return BRLCAD_OK;
@@ -744,7 +744,7 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- printf("Usage: image-file file\n");
+ brst_log(s, MSG_OUT, "Usage: image-file file\n");
return BRLCAD_ERROR;
}
@@ -751,7 +751,7 @@
bu_vls_sprintf(&s->fbfile, "%s", argv[1]);
// Echo command (logCmd in original code)
- printf("%s\t\t%s\n", argv[0], bu_vls_cstr(&s->fbfile));
+ brst_log(s, MSG_OUT, "%s\t\t%s\n", argv[0], bu_vls_cstr(&s->fbfile));
return BRLCAD_OK;
}
@@ -772,21 +772,21 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 3) {
- printf("Usage: input-2d-shot Y Z\n");
+ brst_log(s, MSG_OUT, "Usage: input-2d-shot Y Z\n");
return BRLCAD_ERROR;
}
if (bu_opt_fastf_t(&msg, 1, &argv[1], (void *)&s->fire[X]) < 0) {
- printf("problem reading coordinate: %s\n", bu_vls_cstr(&msg));
+ brst_log(s, MSG_OUT, "problem reading coordinate: %s\n",
bu_vls_cstr(&msg));
ret = BRLCAD_ERROR;
}
if (bu_opt_fastf_t(&msg, 1, &argv[2], (void *)&s->fire[Y]) < 0) {
- printf("problem reading coordinate: %s\n", bu_vls_cstr(&msg));
+ brst_log(s, MSG_OUT, "problem reading coordinate: %s\n",
bu_vls_cstr(&msg));
ret = BRLCAD_ERROR;
}
// Echo command (logCmd in original code)
- printf("%s\t\t%g %g\n", argv[0], s->fire[X], s->fire[Y]);
+ brst_log(s, MSG_OUT, "%s\t\t%g %g\n", argv[0], s->fire[X], s->fire[Y]);
/* after printing, convert to mm */
s->fire[X] /= s->unitconv;
@@ -813,27 +813,27 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 4) {
- printf("Usage: input-3d-shot X Y Z\n");
+ brst_log(s, MSG_OUT, "Usage: input-3d-shot X Y Z\n");
return BRLCAD_ERROR;
}
if (bu_opt_fastf_t(&msg, 1, &argv[1], (void *)&s->fire[X]) < 0) {
- printf("problem reading coordinate: %s\n", bu_vls_cstr(&msg));
+ brst_log(s, MSG_OUT, "problem reading coordinate: %s\n",
bu_vls_cstr(&msg));
ret = BRLCAD_ERROR;
}
if (bu_opt_fastf_t(&msg, 1, &argv[2], (void *)&s->fire[Y]) < 0) {
- printf("problem reading coordinate: %s\n", bu_vls_cstr(&msg));
+ brst_log(s, MSG_OUT, "problem reading coordinate: %s\n",
bu_vls_cstr(&msg));
ret = BRLCAD_ERROR;
}
if (bu_opt_fastf_t(&msg, 1, &argv[3], (void *)&s->fire[Z]) < 0) {
- printf("problem reading coordinate: %s\n", bu_vls_cstr(&msg));
+ brst_log(s, MSG_OUT, "problem reading coordinate: %s\n",
bu_vls_cstr(&msg));
ret = BRLCAD_ERROR;
}
// Echo command (logCmd in original code)
- printf("%s\t\t%g %g %g\n", argv[0], s->fire[X], s->fire[Y], s->fire[Z]);
+ brst_log(s, MSG_OUT, "%s\t\t%g %g %g\n", argv[0], s->fire[X], s->fire[Y],
s->fire[Z]);
/* after printing, convert to mm */
s->fire[X] /= s->unitconv;
@@ -861,17 +861,17 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- printf("Usage: max-barriers #\n");
+ brst_log(s, MSG_OUT, "Usage: max-barriers #\n");
return BRLCAD_ERROR;
}
if (bu_opt_int(&msg, 1, &argv[1], (void *)&s->nbarriers) < 0) {
- printf("problem reading spall barriers per ray count: %s\n",
bu_vls_cstr(&msg));
+ brst_log(s, MSG_OUT, "problem reading spall barriers per ray count:
%s\n", bu_vls_cstr(&msg));
ret = BRLCAD_ERROR;
}
// Echo command (logCmd in original code)
- printf("%s\t\t%d\n", argv[0], s->nbarriers);
+ brst_log(s, MSG_OUT, "%s\t\t%d\n", argv[0], s->nbarriers);
return ret;
}
@@ -892,17 +892,17 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- printf("Usage: max-spall-rays #\n");
+ brst_log(s, MSG_OUT, "Usage: max-spall-rays #\n");
return BRLCAD_ERROR;
}
if (bu_opt_int(&msg, 1, &argv[1], (void *)&s->nspallrays) < 0) {
- printf("problem reading maximum rays per burst: %s\n",
bu_vls_cstr(&msg));
+ brst_log(s, MSG_OUT, "problem reading maximum rays per burst: %s\n",
bu_vls_cstr(&msg));
ret = BRLCAD_ERROR;
}
// Echo command (logCmd in original code)
- printf("%s\t\t%d\n", argv[0], s->nspallrays);
+ brst_log(s, MSG_OUT, "%s\t\t%d\n", argv[0], s->nspallrays);
return ret;
}
@@ -921,7 +921,7 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- printf("Usage: plot-file file\n");
+ brst_log(s, MSG_OUT, "Usage: plot-file file\n");
return BRLCAD_ERROR;
}
@@ -929,7 +929,7 @@
* as it is generated. */
s->plotfp = fopen(argv[1], "wb");
if (!s->plotfp) {
- printf("failed to open plot file: %s\n", argv[1]);
+ brst_log(s, MSG_OUT, "failed to open plot file: %s\n", argv[1]);
return BRLCAD_ERROR;
}
@@ -936,7 +936,7 @@
bu_vls_sprintf(&s->plotfile, "%s", argv[1]);
// Echo command (logCmd in original code)
- printf("%s\t\t%s\n", argv[0], bu_vls_cstr(&s->plotfile));
+ brst_log(s, MSG_OUT, "%s\t\t%s\n", argv[0], bu_vls_cstr(&s->plotfile));
return BRLCAD_OK;
}
@@ -974,7 +974,7 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- printf("Usage: read-2d-shot-file file\n");
+ brst_log(s, MSG_OUT, "Usage: read-2d-shot-file file\n");
return BRLCAD_ERROR;
}
@@ -993,7 +993,7 @@
s->shotfp = fopen(argv[1], "rb");
if (!s->shotfp) {
- printf("failed to open critical component file: %s\n", argv[1]);
+ brst_log(s, MSG_OUT, "failed to open critical component file: %s\n",
argv[1]);
ret = BRLCAD_ERROR;
}
@@ -1000,7 +1000,7 @@
bu_vls_sprintf(&s->shotfile, "%s", argv[1]);
// Echo command (logCmd in original code)
- printf("%s\t%s\n", argv[0], bu_vls_cstr(&s->shotfile));
+ brst_log(s, MSG_OUT, "%s\t%s\n", argv[0], bu_vls_cstr(&s->shotfile));
s->firemode = FM_SHOT | FM_FILE;
@@ -1022,7 +1022,7 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- printf("Usage: read-3d-shot-file file\n");
+ brst_log(s, MSG_OUT, "Usage: read-3d-shot-file file\n");
return BRLCAD_ERROR;
}
@@ -1041,13 +1041,13 @@
s->shotfp = fopen(argv[1], "rb");
if (!s->shotfp) {
- printf("failed to open critical component file: %s\n", argv[1]);
+ brst_log(s, MSG_OUT, "failed to open critical component file: %s\n",
argv[1]);
ret = BRLCAD_ERROR;
}
bu_vls_sprintf(&s->shotfile, "%s", argv[1]);
// Echo command (logCmd in original code)
- printf("%s\t%s\n", argv[0], bu_vls_cstr(&s->shotfile));
+ brst_log(s, MSG_OUT, "%s\t%s\n", argv[0], bu_vls_cstr(&s->shotfile));
s->firemode = FM_SHOT | FM_FILE | FM_3DIM;
@@ -1069,23 +1069,23 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- printf("Usage: burst-armor-file file\n");
+ brst_log(s, MSG_OUT, "Usage: burst-armor-file file\n");
return BRLCAD_ERROR;
}
- //brst_log(s, "Reading burst armor idents...\n");
+ brst_log(s, MSG_LOG, "Reading burst armor idents...\n");
if (!readIdents(&s->armorids, argv[1])) {
- printf("failed to open burst air idents file: %s\n", argv[1]);
+ brst_log(s, MSG_OUT, "failed to open burst air idents file: %s\n",
argv[1]);
return BRLCAD_ERROR;
}
- //brst_log(s, "Reading burst armor idents... done.\n");
+ brst_log(s, MSG_LOG, "Reading burst armor idents... done.\n");
bu_vls_sprintf(&s->armorfile, "%s", argv[1]);
// Echo command (logCmd in original code)
- printf("%s\t%s\n", argv[0], bu_vls_cstr(&s->armorfile));
+ brst_log(s, MSG_OUT, "%s\t%s\n", argv[0], bu_vls_cstr(&s->armorfile));
return ret;
}
@@ -1105,7 +1105,7 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- printf("Usage: read-burst-file file\n");
+ brst_log(s, MSG_OUT, "Usage: read-burst-file file\n");
return BRLCAD_ERROR;
}
@@ -1124,7 +1124,7 @@
s->burstfp = fopen(argv[1], "rb");
if (!s->burstfp) {
- printf("failed to open 3-D burst input file: %s\n", argv[1]);
+ brst_log(s, MSG_OUT, "failed to open 3-D burst input file: %s\n",
argv[1]);
ret = BRLCAD_ERROR;
}
@@ -1131,7 +1131,7 @@
bu_vls_sprintf(&s->burstfile, "%s", argv[1]);
// Echo command (logCmd in original code)
- printf("%s\t\t%s\n", argv[0], bu_vls_cstr(&s->burstfile));
+ brst_log(s, MSG_OUT, "%s\t\t%s\n", argv[0], bu_vls_cstr(&s->burstfile));
s->firemode = FM_BURST | FM_3DIM | FM_FILE;
@@ -1155,13 +1155,13 @@
std::ifstream fs;
fs.open(argv[1]);
if (!fs.is_open()) {
- brst_log(s, "Unable to open command file: %s\n", argv[1]);
+ brst_log(s, MSG_OUT, "Unable to open command file: %s\n", argv[1]);
return BRLCAD_ERROR;
}
std::string bline;
while (std::getline(fs, bline)) {
if (burst_process_line(s, bline.c_str()) != BRLCAD_OK) {
- brst_log(s, "Error processing line: %s\n", bline.c_str());
+ brst_log(s, MSG_OUT, "Error processing line: %s\n", bline.c_str());
fs.close();
return BRLCAD_ERROR;
}
@@ -1187,7 +1187,7 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- printf("Usage: report-overlaps yes|no\n");
+ brst_log(s, MSG_OUT, "Usage: report-overlaps yes|no\n");
return BRLCAD_ERROR;
}
@@ -1195,7 +1195,7 @@
int fval = bu_str_false(argv[1]);
if (!tval && !fval) {
- printf("Invalid boolean string: %s\n", argv[1]);
+ brst_log(s, MSG_OUT, "Invalid boolean string: %s\n", argv[1]);
return BRLCAD_ERROR;
}
@@ -1202,7 +1202,7 @@
s->reportoverlaps = (fval) ? 0 : tval;
// Echo command (logCmd in original code)
- printf("%s\t\t%s\n", argv[0], s->reportoverlaps ? "yes" : "no");
+ brst_log(s, MSG_OUT, "%s\t\t%s\n", argv[0], s->reportoverlaps ? "yes" :
"no");
return BRLCAD_OK;
}
@@ -1221,7 +1221,7 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2 && argc != 3) {
- printf("Usage: shotline-burst yes|no\n");
+ brst_log(s, MSG_OUT, "Usage: shotline-burst yes|no\n");
return BRLCAD_ERROR;
}
@@ -1229,7 +1229,7 @@
int fval = bu_str_false(argv[1]);
if (!tval && !fval) {
- printf("Invalid boolean string: %s\n", argv[1]);
+ brst_log(s, MSG_OUT, "Invalid boolean string: %s\n", argv[1]);
return BRLCAD_ERROR;
}
@@ -1241,7 +1241,7 @@
fval = bu_str_false(argv[2]);
if (!tval && !fval) {
- printf("Invalid boolean string: %s\n", argv[2]);
+ brst_log(s, MSG_OUT, "Invalid boolean string: %s\n", argv[2]);
return BRLCAD_ERROR;
}
s->reqburstair = (fval) ? 0 : tval;
@@ -1250,12 +1250,12 @@
}
// Echo command (logCmd in original code)
- printf("%s\t\t%s %s\n", argv[0], s->shotburst ? "yes" : "no",
s->reqburstair ? "yes" : "no");
+ brst_log(s, MSG_OUT, "%s\t\t%s %s\n", argv[0], s->shotburst ? "yes" :
"no", s->reqburstair ? "yes" : "no");
s->firemode &= ~FM_BURST; /* disable discrete burst points */
} else {
// Echo command (logCmd in original code)
- printf("%s\t\t%s\n", argv[0], s->shotburst ? "yes" : "no");
+ brst_log(s, MSG_OUT, "%s\t\t%s\n", argv[0], s->shotburst ? "yes" :
"no");
}
return BRLCAD_OK;
@@ -1276,7 +1276,7 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- printf("Usage: shotline-file file\n");
+ brst_log(s, MSG_OUT, "Usage: shotline-file file\n");
return BRLCAD_ERROR;
}
@@ -1296,7 +1296,7 @@
* as they are generated. */
s->shotlnfp = fopen(argv[1], "wb");
if (!s->shotlnfp) {
- printf("failed to open shotline file: %s\n", argv[1]);
+ brst_log(s, MSG_OUT, "failed to open shotline file: %s\n", argv[1]);
ret = BRLCAD_ERROR;
}
@@ -1303,7 +1303,7 @@
bu_vls_sprintf(&s->shotlnfile, "%s", argv[1]);
// Echo command (logCmd in original code)
- printf("%s\t\t%s\n", argv[0], bu_vls_cstr(&s->shotlnfile));
+ brst_log(s, MSG_OUT, "%s\t\t%s\n", argv[0], bu_vls_cstr(&s->shotlnfile));
return ret;
}
@@ -1322,7 +1322,7 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- printf("Usage: target-file file\n");
+ brst_log(s, MSG_OUT, "Usage: target-file file\n");
return BRLCAD_ERROR;
}
@@ -1334,7 +1334,7 @@
bu_vls_sprintf(&s->gedfile, "%s", argv[1]);
// Echo command (logCmd in original code)
- printf("%s\t\t%s\n", argv[0], bu_vls_cstr(&s->gedfile));
+ brst_log(s, MSG_OUT, "%s\t\t%s\n", argv[0], bu_vls_cstr(&s->gedfile));
return BRLCAD_OK;
}
@@ -1353,7 +1353,7 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc < 2) {
- printf("%s\n", usage_string);
+ brst_log(s, MSG_OUT, "%s\n", usage_string);
return BRLCAD_ERROR;
}
@@ -1371,7 +1371,7 @@
#endif
// Echo command (logCmd in original code)
- printf("%s\t\t%s\n", argv[0], bu_vls_cstr(&s->objects));
+ brst_log(s, MSG_OUT, "%s\t\t%s\n", argv[0], bu_vls_cstr(&s->objects));
return BRLCAD_OK;
}
@@ -1390,13 +1390,13 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- printf("Usage: units unit\n");
+ brst_log(s, MSG_OUT, "Usage: units unit\n");
return BRLCAD_ERROR;
}
s->unitconv = bu_units_conversion(argv[1]);
if (NEAR_ZERO(s->unitconv, SMALL_FASTF)) {
- printf("Invalid unit: %s\n", argv[1]);
+ brst_log(s, MSG_OUT, "Invalid unit: %s\n", argv[1]);
s->unitconv = 1.0;
return BRLCAD_ERROR;
}
@@ -1421,7 +1421,7 @@
if (BU_STR_EQUAL(ustr, "m")) {
ustr = "meters";
}
- printf("%s\t\t\t%s\n", argv[0], ustr);
+ brst_log(s, MSG_OUT, "%s\t\t\t%s\n", argv[0], ustr);
// Inverse is used in calculations
s->unitconv = 1/s->unitconv;
@@ -1447,7 +1447,7 @@
* as they are generated. */
FILE *cmdfp = fopen(argv[1], "wb");
if (!cmdfp) {
- brst_log(s, "failed to open cmd file for writing: %s\n", argv[1]);
+ brst_log(s, MSG_OUT, "failed to open cmd file for writing: %s\n",
argv[1]);
return BRLCAD_ERROR;
}
@@ -1474,28 +1474,28 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 4) {
- printf("Usage: burst-coordinates X Y Z\n");
+ brst_log(s, MSG_OUT, "Usage: burst-coordinates X Y Z\n");
return BRLCAD_ERROR;
}
if (bu_opt_fastf_t(&msg, 1, &argv[1], (void *)&s->burstpoint[X]) < 0) {
- brst_log(s, "problem reading coordinate X value: %s\n",
bu_vls_cstr(&msg));
+ brst_log(s, MSG_OUT, "problem reading coordinate X value: %s\n",
bu_vls_cstr(&msg));
ret = BRLCAD_ERROR;
}
if (bu_opt_fastf_t(&msg, 1, &argv[2], (void *)&s->burstpoint[Y]) < 0) {
- brst_log(s, "problem reading coordinate Y value: %s\n",
bu_vls_cstr(&msg));
+ brst_log(s, MSG_OUT, "problem reading coordinate Y value: %s\n",
bu_vls_cstr(&msg));
ret = BRLCAD_ERROR;
}
/* convert to mm */
if (bu_opt_fastf_t(&msg, 1, &argv[3], (void *)&s->burstpoint[Z]) < 0) {
- brst_log(s, "problem reading coordinate Z value: %s\n",
bu_vls_cstr(&msg));
+ brst_log(s, MSG_OUT, "problem reading coordinate Z value: %s\n",
bu_vls_cstr(&msg));
ret = BRLCAD_ERROR;
}
// Echo command (logCmd in original code)
- printf("%s\t%g %g %g\n", argv[0], V3ARGS(s->burstpoint));
+ brst_log(s, MSG_OUT, "%s\t%g %g %g\n", argv[0], V3ARGS(s->burstpoint));
/* After echoing, convert to mm */
s->burstpoint[X] /= s->burstpoint[X];
@@ -1522,17 +1522,17 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- printf("Usage: burst-distance #\n");
+ brst_log(s, MSG_OUT, "Usage: burst-distance #\n");
return BRLCAD_ERROR;
}
if (bu_opt_fastf_t(&msg, 1, &argv[1], (void *)&s->bdist) < 0) {
- printf("problem reading distance value: %s\n", bu_vls_cstr(&msg));
+ brst_log(s, MSG_OUT, "problem reading distance value: %s\n",
bu_vls_cstr(&msg));
ret = BRLCAD_ERROR;
}
// Echo command (logCmd in original code)
- printf("%s\t\t%g\n", argv[0], s->bdist);
+ brst_log(s, MSG_OUT, "%s\t\t%g\n", argv[0], s->bdist);
/* convert to mm */
s->bdist /= s->unitconv;
@@ -1555,7 +1555,7 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- printf("Usage: burst-file file\n");
+ brst_log(s, MSG_OUT, "Usage: burst-file file\n");
return BRLCAD_ERROR;
}
@@ -1575,13 +1575,13 @@
* as it is generated. */
s->outfp = fopen(argv[1], "wb");
if (!s->outfp) {
- printf("failed to open burst file: %s\n", argv[1]);
+ brst_log(s, MSG_OUT, "failed to open burst file: %s\n", argv[1]);
ret = BRLCAD_ERROR;
}
bu_vls_sprintf(&s->outfile, "%s", argv[1]);
// Echo command (logCmd in original code)
- printf("%s\t\t%s\n", argv[0], bu_vls_cstr(&s->outfile));
+ brst_log(s, MSG_OUT, "%s\t\t%s\n", argv[0], bu_vls_cstr(&s->outfile));
return ret;
}
@@ -1602,17 +1602,17 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- printf("Usage: cell-size #\n");
+ brst_log(s, MSG_OUT, "Usage: cell-size #\n");
return BRLCAD_ERROR;
}
if (bu_opt_fastf_t(&msg, 1, &argv[1], (void *)&s->cellsz) < 0) {
- printf("problem reading cell size value: %s\n", bu_vls_cstr(&msg));
+ brst_log(s, MSG_OUT, "problem reading cell size value: %s\n",
bu_vls_cstr(&msg));
ret = BRLCAD_ERROR;
}
// Echo command (logCmd in original code)
- printf("%s\t\t%g\n", argv[0], s->cellsz);
+ brst_log(s, MSG_OUT, "%s\t\t%g\n", argv[0], s->cellsz);
/* After echoing, convert to mm */
s->cellsz /= s->unitconv;
@@ -1634,19 +1634,19 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
- //brst_log(s, "Reading ident-to-color mappings...\n");
+ brst_log(s, MSG_LOG, "Reading ident-to-color mappings...\n");
if (!readColors(&s->colorids, argv[1])) {
- printf("failed to open ident to color mappings file: %s\n", argv[1]);
+ brst_log(s, MSG_OUT, "failed to open ident to color mappings file:
%s\n", argv[1]);
return BRLCAD_ERROR;
}
- //brst_log(s, "Reading ident-to-color mappings... done.\n");
+ brst_log(s, MSG_LOG, "Reading ident-to-color mappings... done.\n");
bu_vls_sprintf(&s->colorfile, "%s", argv[1]);
// Echo command (logCmd in original code)
- printf("%s\t\t%s\n", argv[0], bu_vls_cstr(&s->colorfile));
+ brst_log(s, MSG_OUT, "%s\t\t%s\n", argv[0], bu_vls_cstr(&s->colorfile));
return ret;
}
@@ -1667,17 +1667,17 @@
if (!s || !argc || !argv) return BRLCAD_ERROR;
if (argc != 2) {
- printf("Usage: cos-half-angle angle(deg)\n");
+ brst_log(s, MSG_OUT, "Usage: cos-half-angle angle(deg)\n");
return BRLCAD_ERROR;
}
if (bu_opt_fastf_t(&msg, 1, &argv[1], (void *)&s->conehfangle) < 0) {
- printf("problem reading cone half angle value: %s\n",
bu_vls_cstr(&msg));
+ brst_log(s, MSG_OUT, "problem reading cone half angle value: %s\n",
bu_vls_cstr(&msg));
ret = BRLCAD_ERROR;
}
// Echo command (logCmd in original code)
- printf("%s\t\t%g\n", argv[0], s->conehfangle);
+ brst_log(s, MSG_OUT, "%s\t\t%g\n", argv[0], s->conehfangle);
// After echoing, convert to radians for internal use
s->conehfangle /= RAD2DEG;
@@ -1747,13 +1747,13 @@
int ac = bu_argv_from_string(av, strlen(input), input);
if (!ac || !bu_cmd_valid(_burst_cmds, av[0]) == BRLCAD_OK) {
- printf("unrecognzied command: %s\n", av[0]);
+ brst_log(s, MSG_OUT, "unrecognzied command: %s\n", av[0]);
ret = BRLCAD_ERROR;
goto line_done;
}
if (bu_cmd(_burst_cmds, ac, (const char **)av, 0, (void *)s, &ret) !=
BRLCAD_OK) {
- printf("error running command: %s\n", av[0]);
+ brst_log(s, MSG_OUT, "error running command: %s\n", av[0]);
ret = BRLCAD_ERROR;
goto line_done;
}
@@ -1793,7 +1793,7 @@
/* Parse options, fail if anything goes wrong */
if ((argc = bu_opt_parse(&msg, argc, argv, d)) == -1) {
- brst_log(&s, "%s", bu_vls_cstr(&msg));
+ brst_log(&s, MSG_OUT, "%s", bu_vls_cstr(&msg));
bu_vls_free(&msg);
bu_exit(EXIT_FAILURE, NULL);
}
@@ -1803,7 +1803,7 @@
const char *help = bu_opt_describe(d, NULL);
bu_vls_sprintf(&msg, "Usage: 'burst [options]
cmd_file'\n\nOptions:\n%s\n", help);
bu_free((char *)help, "done with help string");
- brst_log(&s, "%s", bu_vls_cstr(&msg));
+ brst_log(&s, MSG_OUT, "%s", bu_vls_cstr(&msg));
bu_vls_free(&msg);
bu_exit(EXIT_SUCCESS, NULL);
}
@@ -1816,13 +1816,13 @@
std::ifstream fs;
fs.open(argv[0]);
if (!fs.is_open()) {
- brst_log(&s, "Unable to open burst batch file: %s\n", argv[0]);
+ brst_log(&s, MSG_OUT, "Unable to open burst batch file: %s\n",
argv[0]);
return EXIT_FAILURE;
}
std::string bline;
while (std::getline(fs, bline)) {
if (burst_process_line(&s, bline.c_str()) != BRLCAD_OK) {
- brst_log(&s, "Error processing line: %s\n", bline.c_str());
+ brst_log(&s, MSG_OUT, "Error processing line: %s\n",
bline.c_str());
fs.close();
return EXIT_FAILURE;
}
Modified: brlcad/branches/bioh/src/burst2/burst.h
===================================================================
--- brlcad/branches/bioh/src/burst2/burst.h 2020-06-12 12:54:34 UTC (rev
76132)
+++ brlcad/branches/bioh/src/burst2/burst.h 2020-06-12 13:44:32 UTC (rev
76133)
@@ -36,6 +36,9 @@
#define TITLE_LEN 72
#define TIMER_LEN 72
+#define MSG_LOG 0
+#define MSG_OUT 1
+
#define MAXDEVWID 10000 /* maximum width of frame buffer */
/* default parameters */
@@ -218,7 +221,7 @@
/* as far as I can tell the original burst code didn't actually use errfile,
* but since it is a defined command we will set up to support it */
-extern void brst_log(struct burst_state *s, const char *, ...);
+extern void brst_log(struct burst_state *s, int TYPE, const char *, ...);
#endif /* BURST_BURST_H */
Modified: brlcad/branches/bioh/src/burst2/grid.cpp
===================================================================
--- brlcad/branches/bioh/src/burst2/grid.cpp 2020-06-12 12:54:34 UTC (rev
76132)
+++ brlcad/branches/bioh/src/burst2/grid.cpp 2020-06-12 13:44:32 UTC (rev
76133)
@@ -204,7 +204,7 @@
}
break;
default :
- brst_log(s, "colorPartition: bad type %d.\n", type);
+ brst_log(s, MSG_OUT, "colorPartition: bad type %d.\n", type);
break;
}
bu_semaphore_release(BU_SEM_SYSCALL);
@@ -308,8 +308,8 @@
}
if (f > 0.0) {
flipct++;
- brst_log(s, "Fixed flipped entry normal:\n");
- brst_log(s, "\tregion \"%s\" solid \"%s\" type %d \"%s\".\n",
+ brst_log(s, MSG_OUT, "Fixed flipped entry normal:\n");
+ brst_log(s, MSG_OUT, "\tregion \"%s\" solid \"%s\" type %d \"%s\".\n",
pp->pt_regionp->reg_name, stp->st_name,
stp->st_id, purpose);
VSCALE(normvec, normvec, -1.0);
@@ -334,8 +334,8 @@
}
if (f < 0.0) {
flipct++;
- brst_log(s, "Fixed flipped exit normal:\n");
- brst_log(s, "\tregion \"%s\" solid \"%s\" type %d \"%s\".\n",
+ brst_log(s, MSG_OUT, "Fixed flipped exit normal:\n");
+ brst_log(s, MSG_OUT, "\tregion \"%s\" solid \"%s\" type %d \"%s\".\n",
pp->pt_regionp->reg_name, stp->st_name,
stp->st_id, purpose);
VSCALE(normvec, normvec, -1.0);
@@ -348,9 +348,9 @@
f_Nerror(struct application *ap)
{
struct burst_state *s = (struct burst_state *)ap->a_uptr;
- brst_log(s, "Couldn't compute thickness or exit point along normal
direction.\n");
- brst_log(s, "\tpnt\t<%12.6f, %12.6f, %12.6f>\n", V3ARGS(ap->a_ray.r_pt));
- brst_log(s, "\tdir\t<%12.6f, %12.6f, %12.6f>\n", V3ARGS(ap->a_ray.r_dir));
+ brst_log(s, MSG_OUT, "Couldn't compute thickness or exit point along
normal direction.\n");
+ brst_log(s, MSG_OUT, "\tpnt\t<%12.6f, %12.6f, %12.6f>\n",
V3ARGS(ap->a_ray.r_pt));
+ brst_log(s, MSG_OUT, "\tdir\t<%12.6f, %12.6f, %12.6f>\n",
V3ARGS(ap->a_ray.r_dir));
ap->a_rbeam = 0.0;
return 0;
}
@@ -409,7 +409,7 @@
VSCALE(a_thick.a_ray.r_dir, normvec, -1.0);
if (rt_shootray(&a_thick) == -1 && s->fatalerror) {
/* Fatal error in application routine. */
- brst_log(s, "Fatal error: raytracing aborted.\n");
+ brst_log(s, MSG_OUT, "Fatal error: raytracing aborted.\n");
return 0.0;
}
return a_thick.a_rbeam;
@@ -664,14 +664,14 @@
VJOIN1(pt, ap->a_ray.r_pt, pp->pt_inhit->hit_dist,
ap->a_ray.r_dir);
- brst_log(s, "OVERLAP:\n");
- brst_log(s, "reg=%s isol=%s, \n",
+ brst_log(s, MSG_LOG, "OVERLAP:\n");
+ brst_log(s, MSG_LOG, "reg=%s isol=%s, \n",
reg1->reg_name, pp->pt_inseg->seg_stp->st_name
);
- brst_log(s, "reg=%s osol=%s, \n",
+ brst_log(s, MSG_LOG, "reg=%s osol=%s, \n",
reg2->reg_name, pp->pt_outseg->seg_stp->st_name
);
- brst_log(s, "depth %.2fmm at (%g, %g, %g) x%d y%d lvl%d purpose=%s\n",
+ brst_log(s, MSG_LOG, "depth %.2fmm at (%g, %g, %g) x%d y%d lvl%d
purpose=%s\n",
depth,
pt[X], pt[Y], pt[Z],
ap->a_x, ap->a_y, ap->a_level, ap->a_purpose
@@ -839,12 +839,12 @@
return;
entryangle = NEAR_EQUAL(icosobliquity, 1.0, COS_TOL) ? 0.0 :
acos(icosobliquity) * RAD2DEG;
if ((normthickness = getNormThickness(ap, cpp, icosobliquity, entrynorm))
<= 0.0 && s->fatalerror) {
- brst_log(s, "Couldn't compute normal thickness.\n");
- brst_log(s, "\tshotline coordinates <%g, %g>\n",
+ brst_log(s, MSG_LOG, "Couldn't compute normal thickness.\n");
+ brst_log(s, MSG_LOG, "\tshotline coordinates <%g, %g>\n",
ap->a_uvec[X]*s->unitconv,
ap->a_uvec[Y]*s->unitconv
);
- brst_log(s, "\tregion name '%s' solid name '%s'\n",
+ brst_log(s, MSG_LOG, "\tregion name '%s' solid name '%s'\n",
cpp->pt_regionp->reg_name,
cpp->pt_inseg->seg_stp->st_name);
return;
@@ -1002,7 +1002,7 @@
bu_semaphore_release(RT_SEM_WORKER);
if ((ncrit = rt_shootray(&a_spall)) == -1 && s->fatalerror) {
/* Fatal error in application routine. */
- brst_log(s, "Error: ray tracing aborted.\n");
+ brst_log(s, MSG_OUT, "Error: ray tracing aborted.\n");
return 0;
}
if (bu_vls_strlen(&s->fbfile) && ncrit > 0) {
@@ -1386,7 +1386,7 @@
VJOIN1(hitpoint, hitpoint, -s->bdist, ap->a_ray.r_dir);
} else if (s->bdist < 0.0) {
/* interior burst not implemented in ground */
- brst_log(s, "User error: negative burst distance can not be
specified with ground plane bursting.\n");
+ brst_log(s, MSG_OUT, "User error: negative burst distance can
not be specified with ground plane bursting.\n");
s->fatalerror = 1;
return -1;
}
@@ -1432,7 +1432,7 @@
VMOVE(vec, scan);
if (items != 2) {
if (items != EOF) {
- brst_log(s, "Fatal error: only %d firing coordinates read.\n",
items);
+ brst_log(s, MSG_OUT, "Fatal error: only %d firing coordinates
read.\n", items);
s->fatalerror = 1;
return 0;
} else {
@@ -1451,7 +1451,7 @@
VMOVE(vec, scan); /* double to fastf_t */
if (items != 3) {
if (items != EOF) {
- brst_log(s, "Fatal error: %d firing coordinates read.\n",
items);
+ brst_log(s, MSG_OUT, "Fatal error: %d firing coordinates
read.\n", items);
s->fatalerror = 1;
return 0;
} else {
@@ -1463,7 +1463,7 @@
vec[Z] /= s->unitconv;
}
} else {
- brst_log(s, "BUG: readShot called with bad firemode.\n");
+ brst_log(s, MSG_OUT, "BUG: readShot called with bad firemode.\n");
return 0;
}
return 1;
@@ -1557,7 +1557,7 @@
VMOVE(vec, scan); /* double to fastf_t */
if (items != 3) {
if (items != EOF) {
- brst_log(s, "Fatal error: %d burst coordinates read.\n", items);
+ brst_log(s, MSG_OUT, "Fatal error: %d burst coordinates read.\n",
items);
s->fatalerror = 1;
return 0;
} else {
@@ -1612,7 +1612,7 @@
prntBurstHdr(s, s->burstpoint, viewdir);
if (! burstPoint(&ag, s->zaxis, s->burstpoint)) {
/* fatal error in application routine */
- brst_log(s, "Fatal error: raytracing aborted.\n");
+ brst_log(s, MSG_OUT, "Fatal error: raytracing aborted.\n");
return 0;
}
if (! TSTBIT(s->firemode, FM_FILE)) {
@@ -1675,7 +1675,7 @@
plotGrid(s, a.a_ray.r_pt);
if (rt_shootray(&a) == -1 && s->fatalerror) {
/* fatal error in application routine */
- brst_log(s, "Fatal error: raytracing aborted.\n");
+ brst_log(s, MSG_OUT, "Fatal error: raytracing aborted.\n");
return 0;
}
if (!TSTBIT(s->firemode, FM_FILE) && TSTBIT(s->firemode, FM_SHOT)) {
@@ -1690,7 +1690,7 @@
prntTimer(struct burst_state *s, const char *str)
{
(void) rt_read_timer(s->timer, TIMER_LEN-1);
- brst_log(s, "%s:\t%s\n", str == NULL ? "(null)" : str, s->timer);
+ brst_log(s, MSG_OUT, "%s:\t%s\n", str == NULL ? "(null)" : str, s->timer);
}
static void
@@ -1708,7 +1708,7 @@
(void) fflush(s->shotlnfp);
prntTimer(s, "view");
if (s->noverlaps > 0) {
- brst_log(s, "%d overlaps detected over %g mm thick.\n", s->noverlaps,
OVERLAP_TOL);
+ brst_log(s, MSG_OUT, "%d overlaps detected over %g mm thick.\n",
s->noverlaps, OVERLAP_TOL);
}
return;
}
@@ -1754,6 +1754,27 @@
) {
bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->outfile));
}
+
+ // For the original burst units, report back using the same string
+ // burst would originally have used (for compatibility). Eventually
+ // would prefer to deprecated this...
+ const char *ustr = bu_units_string(1/s->unitconv);
+ if (BU_STR_EQUAL(ustr, "in")) {
+ ustr = "inches";
+ }
+ if (BU_STR_EQUAL(ustr, "ft")) {
+ ustr = "feet";
+ }
+ if (BU_STR_EQUAL(ustr, "mm")) {
+ ustr = "millimeters";
+ }
+ if (BU_STR_EQUAL(ustr, "cm")) {
+ ustr = "centimeters";
+ }
+ if (BU_STR_EQUAL(ustr, "m")) {
+ ustr = "meters";
+ }
+
if (bu_vls_strlen(&s->shotlnfile)
&& fprintf(s->shotlnfp,
"%c % 9.4f % 8.4f % 7.2f % 7.2f %7.2f %7.2f %7.2f
%-6s\n",
@@ -1765,7 +1786,7 @@
s->modllf*s->unitconv, /* minimum Y'-coordinate of
target */
s->modlup*s->unitconv, /* maximum Z'-coordinate of
target */
s->modldn*s->unitconv, /* minimum Z'-coordinate of
target */
- bu_units_string(s->unitconv)
+ ustr
) < 0
) {
bu_exit(EXIT_FAILURE, "Write failed to file (%s)!\n",
bu_vls_cstr(&s->shotlnfile));
@@ -1801,7 +1822,7 @@
/* initialize frame buffer if appropriate */
if (!imageInit(s)) {
- brst_log(s, "Error: problem opening frame buffer.");
+ brst_log(s, MSG_OUT, "Error: problem opening frame buffer.\n");
return;
}
/* output initial line for this aspect */
@@ -1811,7 +1832,7 @@
s->userinterrupt = 0; /* set by interrupt handler */
rt_prep_timer();
- brst_log(s, "Raytracing");
+ brst_log(s, MSG_LOG, "Raytracing\n");
if (TSTBIT(s->firemode, FM_BURST)) {
if (! doBursts(s))
@@ -1896,7 +1917,7 @@
void
gridInit(struct burst_state *s)
{
- //brst_log(s, "Initializing grid\n");
+ brst_log(s, MSG_LOG, "Initializing grid\n");
rt_prep_timer();
/* compute grid unit vectors */
@@ -2085,7 +2106,7 @@
delta = 0.0;
phiinc = 0.0;
s->raysolidangle = 0.0;
- brst_log(s, "%d sampling rays\n", spallct);
+ brst_log(s, MSG_OUT, "%d sampling rays\n", spallct);
return;
}
@@ -2110,9 +2131,9 @@
spallct++;
}
s->raysolidangle = theta / spallct;
- brst_log(s, "Solid angle of sampling cone = %g\n", theta);
- brst_log(s, "Solid angle per sampling ray = %g\n", s->raysolidangle);
- brst_log(s, "%d sampling rays\n", spallct);
+ brst_log(s, MSG_OUT, "Solid angle of sampling cone = %g\n", theta);
+ brst_log(s, MSG_OUT, "Solid angle per sampling ray = %g\n",
s->raysolidangle);
+ brst_log(s, MSG_OUT, "%d sampling rays\n", spallct);
return;
}
@@ -2124,10 +2145,10 @@
static int gottree = 0;
int loaderror = 0;
if (!bu_vls_strlen(&s->gedfile)) {
- brst_log(s, "No target file has been specified.");
+ brst_log(s, MSG_OUT, "No target file has been specified.\n");
return BRLCAD_ERROR;
}
- //brst_log(s, "Reading target data base\n");
+ brst_log(s, MSG_LOG, "Reading target data base\n");
rt_prep_timer();
if (s->rtip == RTI_NULL) {
char db_title[TITLE_LEN+1];
@@ -2134,7 +2155,7 @@
s->rtip = rt_dirbuild(bu_vls_cstr(&s->gedfile), db_title, TITLE_LEN);
}
if (s->rtip == RTI_NULL) {
- brst_log(s, "Ray tracer failed to read the target file.");
+ brst_log(s, MSG_OUT, "Ray tracer failed to read the target file.");
return BRLCAD_ERROR;
}
prntTimer(s, "dir");
@@ -2149,9 +2170,9 @@
rt_prep_timer();
for (int i = 0; i < ac; i++) {
const char *obj = av[i];
- //brst_log(s, "Loading \"%s\"\n", obj);
+ brst_log(s, MSG_LOG, "Loading \"%s\"\n", obj);
if (rt_gettree(s->rtip, obj) != 0) {
- brst_log(s, "Bad object \"%s\".", obj);
+ brst_log(s, MSG_OUT, "Bad object \"%s\"\n", obj);
loaderror = 1;
}
}
@@ -2164,7 +2185,7 @@
if (loaderror)
return BRLCAD_ERROR;
if (s->rtip->needprep) {
- //brst_log(s, "Prepping solids\n");
+ brst_log(s, MSG_LOG, "Prepping solids\n");
rt_prep_timer();
rt_prep(s->rtip);
prntTimer(s, "prep");
Modified: brlcad/branches/bioh/src/burst2/idents.cpp
===================================================================
--- brlcad/branches/bioh/src/burst2/idents.cpp 2020-06-12 12:54:34 UTC (rev
76132)
+++ brlcad/branches/bioh/src/burst2/idents.cpp 2020-06-12 13:44:32 UTC (rev
76133)
@@ -38,7 +38,7 @@
#include "./burst.h"
-#define DEBUG_IDENTS 1
+#define DEBUG_IDENTS 0
int
findIdents(int ident, struct bu_ptbl *idpl)
@@ -161,7 +161,7 @@
bu_log("Invalid colors line: %s\n", iline.c_str());
continue;
}
- if (parsevar.size() != 5) {
+ if (parsevar.size() != 6) {
bu_log("readColors(): only %zd items read\n", parsevar.size());
continue;
}
Modified: brlcad/branches/bioh/src/burst2/paint.cpp
===================================================================
--- brlcad/branches/bioh/src/burst2/paint.cpp 2020-06-12 12:54:34 UTC (rev
76132)
+++ brlcad/branches/bioh/src/burst2/paint.cpp 2020-06-12 13:44:32 UTC (rev
76133)
@@ -169,7 +169,7 @@
err = fb_write(s->fbiop, x, y, pixel, 1);
bu_semaphore_release(BU_SEM_GENERAL);
if (err == -1)
- brst_log(s, "Write failed to pixel <%d, %d> from cell <%d, %d>.\n", x,
y, ap->a_x, ap->a_y);
+ brst_log(s, MSG_OUT, "Write failed to pixel <%d, %d> from cell <%d,
%d>.\n", x, y, ap->a_x, ap->a_y);
return;
}
@@ -179,9 +179,9 @@
int
openFbDevice(struct burst_state *s, struct bu_vls *fbdev)
{
- //brst_log(s, "Opening frame buffer\n");
+ brst_log(s, MSG_LOG, "Opening frame buffer\n");
if (s->zoom < 1) {
- brst_log(s, "Device is too small to display image.\n");
+ brst_log(s, MSG_OUT, "Device is too small to display image.\n");
return 0;
}
if (((s->fbiop != FB_NULL && fb_getwidth(s->fbiop) != s->devwid) ||
s->pixgrid == NULL)
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