Revision: 76122
          http://sourceforge.net/p/brlcad/code/76122
Author:   starseeker
Date:     2020-06-11 22:16:23 +0000 (Thu, 11 Jun 2020)
Log Message:
-----------
More work on adding command echos.  These will actually make it fairly 
straightforward to validate the behavior of most of the commands (execute will 
be the tough one as it invokes the raytrace logic and output generation...)

Modified Paths:
--------------
    brlcad/branches/bioh/src/burst2/burst.cpp
    brlcad/branches/bioh/src/burst2/burst.h
    brlcad/branches/bioh/src/burst2/grid.cpp

Modified: brlcad/branches/bioh/src/burst2/burst.cpp
===================================================================
--- brlcad/branches/bioh/src/burst2/burst.cpp   2020-06-11 21:51:34 UTC (rev 
76121)
+++ brlcad/branches/bioh/src/burst2/burst.cpp   2020-06-11 22:16:23 UTC (rev 
76122)
@@ -224,21 +224,21 @@
     }
 
     if (bu_opt_fastf_t(&msg, 1, &argv[1], (void *)&s->viewazim) < 0) {
-       printf("problem reading azimuth: %s\n", bu_vls_cstr(&msg));
+       brst_log(s, "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) {
-       printf("problem reading elevation: %s\n", bu_vls_cstr(&msg));
+       brst_log(s, "problem reading elevation: %s\n", bu_vls_cstr(&msg));
        ret = BRLCAD_ERROR;
     }
 
-    // Echo command (logCmd in original code)*/
+    // Echo command (logCmd in original code)
     printf("%s\t%g %g\n", argv[0], s->viewazim, s->viewelev);
 
     // After printing, convert to radians for internal use
     s->viewazim /= RAD2DEG;
-    s->vieweelv /= RAD2DEG;
+    s->viewelev /= RAD2DEG;
 
     bu_vls_free(&msg);
     return ret;
@@ -264,7 +264,7 @@
        return BRLCAD_ERROR;
     }
 
-    printf("Reading critical component idents...\n");
+    brst_log(s, "Reading critical component idents...\n");
 
     if (!readIdents(&s->critids, argv[1])) {
        printf("failed to open critical component file: %s\n", argv[1]);
@@ -271,10 +271,13 @@
        return BRLCAD_ERROR;
     }
 
-    printf("Reading critical component idents... done.\n");
+    brst_log(s, "Reading critical component idents... done.\n");
 
     bu_vls_sprintf(&s->critfile, "%s", argv[1]);
 
+    // Echo command (logCmd in original code)
+    printf("%s\t%s", argv[0], bu_vls_cstr(&s->critfile));
+
     return ret;
 }
 
@@ -293,7 +296,7 @@
     if (!s || !argc || !argv) return BRLCAD_ERROR;
 
     if (argc != 2) {
-       printf("Usage: deflect-spall-cone yes|no\n");
+       brst_log(s, "Usage: deflect-spall-cone yes|no\n");
        return BRLCAD_ERROR;
     }
 
@@ -301,12 +304,15 @@
     int fval = bu_str_false(argv[1]);
 
     if (!tval && !fval) {
-       printf("Invalid boolean string: %s\n", argv[1]);
+       brst_log(s, "Invalid boolean string: %s\n", argv[1]);
        return BRLCAD_ERROR;
     }
 
     s->deflectcone = (fval) ? 0 : tval;
 
+    // Echo command (logCmd in original code)
+    printf("%s\t%s", argv[0], s->deflectcone ? "yes" : "no");
+
     return BRLCAD_OK;
 }
 
@@ -338,6 +344,9 @@
 
     s->dithercells = (fval) ? 0 : tval;
 
+    // Echo command (logCmd in original code)
+    printf("%s\t\t%s", argv[0], s->dithercells ? "yes" : "no");
+
     return BRLCAD_OK;
 }
 
@@ -352,6 +361,10 @@
 
     struct burst_state *s = (struct burst_state *)bs;
     s->firemode = FM_GRID;
+
+    // Echo command (logCmd in original code)
+    printf("enclose-target\n");
+
     return BRLCAD_OK;
 }
 
@@ -403,6 +416,9 @@
     /* convert to mm */
     s->gridup = s->gridup * s->unitconv;
 
+    // Echo command (logCmd in original code)
+    printf("%s\t\t%g %g %g %g", argv[0], s->gridlf, s->gridrt, s->griddn, 
s->gridup);
+
     bu_vls_free(&msg);
     return ret;
 }
@@ -445,6 +461,9 @@
        ret = BRLCAD_ERROR;
     }
 
+    // Echo command (logCmd in original code)
+    printf("%s\t\t%s", argv[0], argv[1]);
+
     return ret;
 }
 
@@ -466,10 +485,7 @@
        return BRLCAD_ERROR;
     }
 
-    // TODO
-    //ret = execute_run(s);
-
-    return BRLCAD_OK;
+    return execute_run(s);
 }
 
 extern "C" int
@@ -512,6 +528,9 @@
 
     bu_vls_sprintf(&s->gridfile, "%s", argv[1]);
 
+    // Echo command (logCmd in original code)
+    printf("%s\t\t%s", argv[0], bu_vls_cstr(&s->gridfile));
+
     return ret;
 }
 
@@ -546,6 +565,8 @@
     s->groundburst = (fval) ? 0 : tval;
 
     if (!s->groundburst) {
+       // Echo command (logCmd in original code)
+       printf("%s\t\tno\n", argv[0]);
        return ret;
     }
 
@@ -584,6 +605,9 @@
     /* convert to mm */
     s->grndrt = s->grndrt * s->unitconv;
 
+    // Echo command (logCmd in original code)
+    printf("%s\t\tyes %g %g %g %g %g", argv[0], s->grndht, s->grndfr, 
s->grndbk, s->grndlf, s->grndrt);
+
     bu_vls_free(&msg);
     return ret;
 }
@@ -646,7 +670,7 @@
        return BRLCAD_ERROR;
     }
 
-    printf("Reading burst air idents...\n");
+    brst_log(s, "Reading burst air idents...\n");
 
     if (!readIdents(&s->airids, argv[1])) {
        printf("failed to open burst air idents file: %s\n", argv[1]);
@@ -653,10 +677,13 @@
        return BRLCAD_ERROR;
     }
 
-    printf("Reading burst air idents... done.\n");
+    brst_log(s, "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", argv[0], bu_vls_cstr(&s->airfile));
+
     return ret;
 }
 
@@ -701,6 +728,10 @@
 
     bu_vls_sprintf(&s->histfile, "%s", argv[1]);
 
+    // Echo command (logCmd in original code)
+    printf("%s\t\t%s", argv[0], bu_vls_cstr(&s->histfile));
+
+
     return BRLCAD_OK;
 }
 

Modified: brlcad/branches/bioh/src/burst2/burst.h
===================================================================
--- brlcad/branches/bioh/src/burst2/burst.h     2020-06-11 21:51:34 UTC (rev 
76121)
+++ brlcad/branches/bioh/src/burst2/burst.h     2020-06-11 22:16:23 UTC (rev 
76122)
@@ -200,6 +200,8 @@
 
 extern void burst_state_init(struct burst_state *s);
 
+extern int execute_run(struct burst_state *s);
+
 extern int findIdents(int ident, struct bu_ptbl *idpl);
 extern int readIdents(struct bu_ptbl *idlist, const char *fname);
 extern int readColors(struct bu_ptbl *idlist, const char *fname);

Modified: brlcad/branches/bioh/src/burst2/grid.cpp
===================================================================
--- brlcad/branches/bioh/src/burst2/grid.cpp    2020-06-11 21:51:34 UTC (rev 
76121)
+++ brlcad/branches/bioh/src/burst2/grid.cpp    2020-06-11 22:16:23 UTC (rev 
76122)
@@ -2118,7 +2118,7 @@
 
 #define WHITESPACE     " \t"
 
-void
+int
 execute_run(struct burst_state *s)
 {
     static int gottree = 0;
@@ -2125,7 +2125,7 @@
     int loaderror = 0;
     if (!bu_vls_strlen(&s->gedfile)) {
        brst_log(s, "No target file has been specified.");
-       return;
+       return BRLCAD_ERROR;
     }
     brst_log(s, "Reading target data base");
     rt_prep_timer();
@@ -2135,7 +2135,7 @@
     }
     if (s->rtip == RTI_NULL) {
        brst_log(s, "Ray tracer failed to read the target file.");
-       return;
+       return BRLCAD_ERROR;
     }
     prntTimer(s, "dir");
     /* Add air into int trees, must be set after rt_dirbuild() and before
@@ -2162,7 +2162,7 @@
        prntTimer(s, "load");
     }
     if (loaderror)
-       return;
+       return BRLCAD_ERROR;
     if (s->rtip->needprep) {
        brst_log(s, "Prepping solids");
        rt_prep_timer();
@@ -2174,7 +2174,7 @@
        spallInit(s);
     }
     gridModel(s);
-    return;
+    return BRLCAD_OK;
 }
 
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to