Skip to content

Commit

Permalink
Make most of the remaining ged_exec commands in the libged code expli…
Browse files Browse the repository at this point in the history
…cit wrappings. A few are deliberately left as tests or in cases where non-specific command execution is the intent.
  • Loading branch information
starseeker committed Nov 22, 2024
1 parent 31d7c8b commit c3014be
Show file tree
Hide file tree
Showing 17 changed files with 311 additions and 313 deletions.
2 changes: 1 addition & 1 deletion include/ged/commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ __BEGIN_DECLS
/** @addtogroup ged_plugins */
/** @{ */
/** Execute plugin based command */
#ifndef GED_PLUGIN
#if !defined(GED_PLUGIN) && !defined(GED_EXEC_NORAW)
GED_EXPORT extern int ged_exec(struct ged *gedp, int argc, const char *argv[]);
#endif
/** @} */
Expand Down
12 changes: 6 additions & 6 deletions src/libged/facetize/subprocess/brep_csg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ _brep_csg_tessellate(struct ged *gedp, struct directory *dp, tess_opts *s)
av[1] = tmpfil;
av[2] = dp->d_namep;
av[3] = NULL;
ged_exec(gedp, 3, av);
ged_exec_keep(gedp, 3, av);

// Work on the brep
struct ged *wgedp = ged_open("db", tmpfil, 1);
Expand All @@ -64,15 +64,15 @@ _brep_csg_tessellate(struct ged *gedp, struct directory *dp, tess_opts *s)
av[1] = dp->d_namep;
av[2] = "csg";
av[3] = NULL;
if (ged_exec(wgedp, 3, av) != BRLCAD_OK) {
if (ged_exec_brep(wgedp, 3, av) != BRLCAD_OK) {
bu_file_delete(tmpfil);
return BRLCAD_ERROR;
}

av[0] = "kill";
av[2] = dp->d_namep;
av[3] = NULL;
if (ged_exec(wgedp, 2, av) != BRLCAD_OK) {
if (ged_exec_kill(wgedp, 2, av) != BRLCAD_OK) {
bu_file_delete(tmpfil);
return BRLCAD_ERROR;
}
Expand All @@ -91,7 +91,7 @@ _brep_csg_tessellate(struct ged *gedp, struct directory *dp, tess_opts *s)
av[4] = bu_vls_cstr(&comb_name);
av[5] = dp->d_namep;
av[6] = NULL;
if (ged_exec(wgedp, 6, av) != BRLCAD_OK) {
if (ged_exec_facetize(wgedp, 6, av) != BRLCAD_OK) {
bu_vls_free(&comb_name);
bu_file_delete(tmpfil);
return BRLCAD_ERROR;
Expand All @@ -101,7 +101,7 @@ _brep_csg_tessellate(struct ged *gedp, struct directory *dp, tess_opts *s)
av[1] = "-f";
av[2] = bu_vls_cstr(&comb_name);
av[3] = NULL;
if (ged_exec(wgedp, 3, av) != BRLCAD_OK) {
if (ged_exec_killtree(wgedp, 3, av) != BRLCAD_OK) {
bu_vls_free(&comb_name);
bu_file_delete(tmpfil);
return BRLCAD_ERROR;
Expand All @@ -115,7 +115,7 @@ _brep_csg_tessellate(struct ged *gedp, struct directory *dp, tess_opts *s)
av[1] = "-O";
av[2] = tmpfil;
av[3] = NULL;
if (ged_exec(gedp, 3, av) != BRLCAD_OK) {
if (ged_exec_dbconcat(gedp, 3, av) != BRLCAD_OK) {
return BRLCAD_ERROR;
}

Expand Down
6 changes: 3 additions & 3 deletions src/libged/simulate/tests/simulate_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ namespace

const char *argv[] = {"simulate", "scene.c", "3.0"};

if (BRLCAD_OK != ged_exec(&ged_instance, sizeof(argv) / sizeof(argv[0]), argv))
if (BRLCAD_OK != ged_exec_simulate(&ged_instance, sizeof(argv) / sizeof(argv[0]), argv))
bu_bomb("ged_simulate() failed");

{
Expand Down Expand Up @@ -226,7 +226,7 @@ namespace

const char *argv[] = {"simulate", "scene.c", "3.0"};

if (BRLCAD_OK != ged_exec(&ged_instance, sizeof(argv) / sizeof(argv[0]), argv))
if (BRLCAD_OK != ged_exec_simulate(&ged_instance, sizeof(argv) / sizeof(argv[0]), argv))
bu_bomb("ged_simulate() failed");

const mat_t expected_falling_matrix = {
Expand Down Expand Up @@ -307,7 +307,7 @@ namespace

const char *argv[] = {"simulate", "scene.c", "10.0"};

if (BRLCAD_OK != ged_exec(&ged_instance, sizeof(argv) / sizeof(argv[0]), argv))
if (BRLCAD_OK != ged_exec_simulate(&ged_instance, sizeof(argv) / sizeof(argv[0]), argv))
bu_bomb("ged_simulate() failed");

{
Expand Down
6 changes: 3 additions & 3 deletions src/libged/tests/draw/aet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ img_cmp(int vnum, int id, struct ged *gedp, const char *cdir, int soft_fail)
s_av[1] = "-D";
s_av[2] = bu_vls_cstr(dm_get_pathname(dmp));
s_av[3] = bu_vls_cstr(&tname);
if (ged_exec(gedp, 4, s_av) & BRLCAD_ERROR) {
if (ged_exec_screengrab(gedp, 4, s_av) & BRLCAD_ERROR) {
bu_log("Failed to grab screen for DM %s\n", bu_vls_cstr(dm_get_pathname(dmp)));
bu_vls_free(&tname);
return;
Expand Down Expand Up @@ -210,7 +210,7 @@ main(int ac, char *av[]) {
bu_vls_sprintf(&dm_name, "SW%zd", i);
s_av[5] = bu_vls_cstr(&dm_name);
s_av[6] = NULL;
ged_exec(dbp, 6, s_av);
ged_exec_dm(dbp, 6, s_av);
bu_vls_free(&dm_name);

struct dm *dmp = (struct dm *)v->dmp;
Expand Down Expand Up @@ -262,7 +262,7 @@ main(int ac, char *av[]) {
s_av[1] = "-m0";
s_av[2] = "all.g";
s_av[3] = NULL;
ged_exec(dbp, 4, s_av);
ged_exec_draw(dbp, 4, s_av);

// Sanity
img_cmp(0, 1, dbp, av[1], soft_fail);
Expand Down
Loading

0 comments on commit c3014be

Please sign in to comment.