Revision: 72407 http://sourceforge.net/p/brlcad/code/72407 Author: brlcad Date: 2019-02-11 20:13:25 +0000 (Mon, 11 Feb 2019) Log Message: ----------- remove glob_compat_mode and output_as_return from global namespace, to static global. simplify setup slightly.
Modified Paths: -------------- brlcad/trunk/src/mged/cmd.c brlcad/trunk/src/mged/setup.c Modified: brlcad/trunk/src/mged/cmd.c =================================================================== --- brlcad/trunk/src/mged/cmd.c 2019-02-11 19:39:52 UTC (rev 72406) +++ brlcad/trunk/src/mged/cmd.c 2019-02-11 20:13:25 UTC (rev 72407) @@ -70,11 +70,12 @@ extern int mged_db_upgrade; extern int mged_db_version; -int glob_compat_mode = 1; -int output_as_return = 1; +static int glob_compat_mode = 1; +static int output_as_return = 1; Tk_Window tkwin = NULL; + /* The following is for GUI output hooks: contains name of function to * run with output. */ @@ -231,10 +232,10 @@ Tcl_AppendResult(interpreter, bu_vls_addr(gedp->ged_result_str), NULL); if (ret & GED_HELP) - return TCL_OK; + return TCL_OK; if (ret) - return TCL_ERROR; + return TCL_ERROR; av[0] = "draw"; av[1] = argv[1]; @@ -596,17 +597,17 @@ /* This code is for debugging/testing the new ged return mechanism */ #if 0 { - int r_loop = 0; - size_t result_cnt = 0; + int r_loop = 0; + size_t result_cnt = 0; - result_cnt = ged_results_count(gedp->ged_results); - if (result_cnt > 0) { - bu_log("Results container holds results(%d):\n", result_cnt); - for (r_loop = 0; r_loop < (int)result_cnt; r_loop++) { - bu_log("%s\n", ged_results_get(gedp->ged_results, r_loop)); + result_cnt = ged_results_count(gedp->ged_results); + if (result_cnt > 0) { + bu_log("Results container holds results(%d):\n", result_cnt); + for (r_loop = 0; r_loop < (int)result_cnt; r_loop++) { + bu_log("%s\n", ged_results_get(gedp->ged_results, r_loop)); + } } } - } #endif if (ret & GED_MORE) @@ -692,6 +693,7 @@ return TCL_OK; } + int cmd_ged_dm_wrapper(ClientData clientData, Tcl_Interp *interpreter, int argc, const char *argv[]) { @@ -987,9 +989,6 @@ } - - - /** * This routine is called to process a vls full of commands. Each * command is newline terminated. The input string will not be @@ -1348,7 +1347,7 @@ if (clp->cl_tie) { if (dm_get_pathname(dmp)) { bu_vls_printf(&vls, "%s %s", bu_vls_addr(&clp->cl_name), - bu_vls_addr(dm_get_pathname(clp->cl_tie->dml_dmp))); + bu_vls_addr(dm_get_pathname(clp->cl_tie->dml_dmp))); Tcl_AppendElement(interpreter, bu_vls_addr(&vls)); } } else { @@ -1361,7 +1360,7 @@ if (clp->cl_tie) { if (dm_get_pathname(dmp)) { bu_vls_printf(&vls, "%s %s", bu_vls_addr(&clp->cl_name), - bu_vls_addr(dm_get_pathname(clp->cl_tie->dml_dmp))); + bu_vls_addr(dm_get_pathname(clp->cl_tie->dml_dmp))); Tcl_AppendElement(interpreter, bu_vls_addr(&vls)); } } else { @@ -1560,6 +1559,10 @@ Tcl_LinkVar(interpreter, "edit_class", (char *)&es_edclass, TCL_LINK_INT); Tcl_LinkVar(interpreter, "edit_solid_flag", (char *)&es_edflag, TCL_LINK_INT); Tcl_LinkVar(interpreter, "edit_object_flag", (char *)&edobj, TCL_LINK_INT); + + /* link some tcl variables to these corresponding globals */ + Tcl_LinkVar(INTERP, "glob_compat_mode", (char *)&glob_compat_mode, TCL_LINK_BOOLEAN); + Tcl_LinkVar(INTERP, "output_as_return", (char *)&output_as_return, TCL_LINK_BOOLEAN); } @@ -1574,6 +1577,9 @@ Tcl_UnlinkVar(interpreter, "edit_class"); Tcl_UnlinkVar(interpreter, "edit_solid_flag"); Tcl_UnlinkVar(interpreter, "edit_object_flag"); + + Tcl_UnlinkVar(interpreter, "glob_compat_mode"); + Tcl_UnlinkVar(interpreter, "output_as_return"); } @@ -1598,6 +1604,7 @@ return TCL_OK; } + /** *@brief * Called when the named proc created by rt_gettrees() is destroyed. @@ -1618,6 +1625,7 @@ bu_free((void *)ap, "struct application"); } + int cmd_rt_gettrees(ClientData UNUSED(clientData), Tcl_Interp *UNUSED(interpreter), int argc, const char *argv[]) { @@ -1794,6 +1802,7 @@ } + /** * "tol" displays current settings * "tol abs #" sets absolute tolerance. # > 0.0 @@ -1876,6 +1885,7 @@ return edit_com(argc, argv, 1); } + /** * Format: ev objects */ @@ -1950,11 +1960,12 @@ return TCL_OK; } + int cmd_ps(ClientData UNUSED(clientData), - Tcl_Interp *interpreter, - int UNUSED(argc), - const char **UNUSED(argv)) + Tcl_Interp *interpreter, + int UNUSED(argc), + const char **UNUSED(argv)) { int ret = 0; const char *av[3]; @@ -1968,6 +1979,7 @@ return (ret) ? TCL_ERROR : TCL_OK; } + int cmd_stub(ClientData UNUSED(clientData), Tcl_Interp *UNUSED(interpreter), int argc, const char *argv[]) { @@ -1986,6 +1998,7 @@ return TCL_ERROR; } + /* * Local Variables: * mode: C Modified: brlcad/trunk/src/mged/setup.c =================================================================== --- brlcad/trunk/src/mged/setup.c 2019-02-11 19:39:52 UTC (rev 72406) +++ brlcad/trunk/src/mged/setup.c 2019-02-11 20:13:25 UTC (rev 72407) @@ -393,10 +393,6 @@ struct cmdtab *ctp; struct bu_vls temp = BU_VLS_INIT_ZERO; - /* from cmd.c */ - extern int glob_compat_mode; - extern int output_as_return; - for (ctp = mged_cmdtab; ctp->name != NULL; ctp++) { bu_vls_strcpy(&temp, "_mged_"); bu_vls_strcat(&temp, ctp->name); @@ -407,10 +403,6 @@ (ClientData)ctp, (Tcl_CmdDeleteProc *)NULL); } - /* link some tcl variables to these corresponding globals */ - Tcl_LinkVar(INTERP, "glob_compat_mode", (char *)&glob_compat_mode, TCL_LINK_BOOLEAN); - Tcl_LinkVar(INTERP, "output_as_return", (char *)&output_as_return, TCL_LINK_BOOLEAN); - /* Init mged's Tcl interface to libwdb */ Wdb_Init(INTERP); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits