Revision: 76331
http://sourceforge.net/p/brlcad/code/76331
Author: starseeker
Date: 2020-07-14 18:58:44 +0000 (Tue, 14 Jul 2020)
Log Message:
-----------
consolidate
Modified Paths:
--------------
brlcad/trunk/src/libtclcad/CMakeLists.txt
brlcad/trunk/src/libtclcad/tclcad_init.c
Removed Paths:
-------------
brlcad/trunk/src/libtclcad/tclcad.c
Modified: brlcad/trunk/src/libtclcad/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libtclcad/CMakeLists.txt 2020-07-14 18:54:29 UTC (rev
76330)
+++ brlcad/trunk/src/libtclcad/CMakeLists.txt 2020-07-14 18:58:44 UTC (rev
76331)
@@ -2,7 +2,6 @@
bu_funcs.c
bn_funcs.c
rt_funcs.c
- tclcad.c
auto_path.c
tclcad_obj.c
tclcad_eval.c
Deleted: brlcad/trunk/src/libtclcad/tclcad.c
===================================================================
--- brlcad/trunk/src/libtclcad/tclcad.c 2020-07-14 18:54:29 UTC (rev 76330)
+++ brlcad/trunk/src/libtclcad/tclcad.c 2020-07-14 18:58:44 UTC (rev 76331)
@@ -1,169 +0,0 @@
-/* T C L C A D . C
- * BRL-CAD
- *
- * Copyright (c) 2004-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- *
- */
-/** @file libtclcad/tclcad.c
- *
- * Initialize BRL-CAD's Tcl interface.
- *
- */
-
-#include "common.h"
-
-#define RESOURCE_INCLUDED 1
-#include <tcl.h>
-#ifdef HAVE_TK
-# include <tk.h>
-#endif
-
-#include "dm.h"
-#include "dm.h"
-#include "bn.h"
-#include "vmath.h"
-#include "raytrace.h"
-#include "tclcad.h"
-
-/* Private headers */
-#include "brlcad_version.h"
-#include "tclcad_private.h"
-
-
-/* defined in cmdhist_obj.c */
-extern int Cho_Init(Tcl_Interp *interp);
-
-
-int
-library_initialized(int setit)
-{
- static int initialized = 0;
- if (setit)
- initialized = 1;
-
- return initialized;
-}
-
-
-static int
-wrapper_func(ClientData data, Tcl_Interp *interp, int argc, const char *argv[])
-{
- struct bu_cmdtab *ctp = (struct bu_cmdtab *)data;
-
- return ctp->ct_func(interp, argc, argv);
-}
-
-
-void
-tclcad_register_cmds(Tcl_Interp *interp, struct bu_cmdtab *cmds)
-{
- struct bu_cmdtab *ctp = NULL;
-
- for (ctp = cmds; ctp->ct_name != (char *)NULL; ctp++) {
- (void)Tcl_CreateCommand(interp, ctp->ct_name, wrapper_func,
(ClientData)ctp, (Tcl_CmdDeleteProc *)NULL);
- }
-}
-
-
-int
-Tclcad_Init(Tcl_Interp *interp)
-{
- if (library_initialized(0))
- return TCL_OK;
-
- if (Tcl_Init(interp) == TCL_ERROR) {
- return TCL_ERROR;
- }
-
-#ifdef HAVE_TK
- if (Tk_Init(interp) == TCL_ERROR) {
- return TCL_ERROR;
- }
-#endif
-
- /* Locate the BRL-CAD-specific Tcl scripts, set the auto_path */
- tclcad_auto_path(interp);
-
- /* Initialize [incr Tcl] */
- if (Tcl_Eval(interp, "package require Itcl") != TCL_OK) {
- bu_log("Tcl_Eval ERROR:\n%s\n", Tcl_GetStringResult(interp));
- return TCL_ERROR;
- }
-
-#ifdef HAVE_TK
- /* Initialize [incr Tk] */
- if (Tcl_Eval(interp, "package require Itk") != TCL_OK) {
- bu_log("Tcl_Eval ERROR:\n%s\n", Tcl_GetStringResult(interp));
- return TCL_ERROR;
- }
-#endif
-
- /* Initialize the Iwidgets package */
- if (Tcl_Eval(interp, "package require Iwidgets") != TCL_OK) {
- bu_log("Tcl_Eval ERROR:\n%s\n", Tcl_GetStringResult(interp));
- return TCL_ERROR;
- }
-
- /* Initialize libstruct dm */
- if (Dm_Init(interp) == TCL_ERROR) {
- bu_log("Dm_Init ERROR:\n%s\n", Tcl_GetStringResult(interp));
- return TCL_ERROR;
- }
-
- /* Initialize libbu */
- if (Bu_Init(interp) == TCL_ERROR) {
- bu_log("Bu_Init ERROR:\n%s\n", Tcl_GetStringResult(interp));
- return TCL_ERROR;
- }
-
- /* Initialize libbn */
- if (Bn_Init(interp) == TCL_ERROR) {
- bu_log("Bn_Init ERROR:\n%s\n", Tcl_GetStringResult(interp));
- return TCL_ERROR;
- }
-
- /* Initialize librt */
- if (Rt_Init(interp) == TCL_ERROR) {
- bu_log("Rt_Init ERROR:\n%s\n", Tcl_GetStringResult(interp));
- return TCL_ERROR;
- }
-
- /* Initialize the GED object */
- if (Go_Init(interp) == TCL_ERROR) {
- bu_log("Go_Init ERROR:\n%s\n", Tcl_GetStringResult(interp));
- return TCL_ERROR;
- }
-
- /* initialize command history objects */
- Cho_Init(interp);
-
- Tcl_PkgProvide(interp, "Tclcad", brlcad_version());
-
- (void)library_initialized(1);
-
- return TCL_OK;
-}
-
-/*
- * Local Variables:
- * mode: C
- * tab-width: 8
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Modified: brlcad/trunk/src/libtclcad/tclcad_init.c
===================================================================
--- brlcad/trunk/src/libtclcad/tclcad_init.c 2020-07-14 18:54:29 UTC (rev
76330)
+++ brlcad/trunk/src/libtclcad/tclcad_init.c 2020-07-14 18:58:44 UTC (rev
76331)
@@ -19,18 +19,145 @@
*/
/** @file tclcad_init.c
*
- * Functions for initializing Tcl environments.
+ * Functions for initializing Tcl environments and BRL-CAD's libtclcad
+ * interface.
*
*/
#include "common.h"
+
+#define RESOURCE_INCLUDED 1
#include <tcl.h>
#ifdef HAVE_TK
# include <tk.h>
#endif
+
+#include "vmath.h"
+#include "bn.h"
+#include "dm.h"
+#include "raytrace.h"
#include "tclcad.h"
+/* Private headers */
+#include "brlcad_version.h"
+#include "tclcad_private.h"
+
+/* defined in cmdhist_obj.c */
+extern int Cho_Init(Tcl_Interp *interp);
+
+
+int
+library_initialized(int setit)
+{
+ static int initialized = 0;
+ if (setit)
+ initialized = 1;
+
+ return initialized;
+}
+
+
+static int
+wrapper_func(ClientData data, Tcl_Interp *interp, int argc, const char *argv[])
+{
+ struct bu_cmdtab *ctp = (struct bu_cmdtab *)data;
+
+ return ctp->ct_func(interp, argc, argv);
+}
+
+
+void
+tclcad_register_cmds(Tcl_Interp *interp, struct bu_cmdtab *cmds)
+{
+ struct bu_cmdtab *ctp = NULL;
+
+ for (ctp = cmds; ctp->ct_name != (char *)NULL; ctp++) {
+ (void)Tcl_CreateCommand(interp, ctp->ct_name, wrapper_func,
(ClientData)ctp, (Tcl_CmdDeleteProc *)NULL);
+ }
+}
+
+
+int
+Tclcad_Init(Tcl_Interp *interp)
+{
+ if (library_initialized(0))
+ return TCL_OK;
+
+ if (Tcl_Init(interp) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+
+#ifdef HAVE_TK
+ if (Tk_Init(interp) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+#endif
+
+ /* Locate the BRL-CAD-specific Tcl scripts, set the auto_path */
+ tclcad_auto_path(interp);
+
+ /* Initialize [incr Tcl] */
+ if (Tcl_Eval(interp, "package require Itcl") != TCL_OK) {
+ bu_log("Tcl_Eval ERROR:\n%s\n", Tcl_GetStringResult(interp));
+ return TCL_ERROR;
+ }
+
+#ifdef HAVE_TK
+ /* Initialize [incr Tk] */
+ if (Tcl_Eval(interp, "package require Itk") != TCL_OK) {
+ bu_log("Tcl_Eval ERROR:\n%s\n", Tcl_GetStringResult(interp));
+ return TCL_ERROR;
+ }
+#endif
+
+ /* Initialize the Iwidgets package */
+ if (Tcl_Eval(interp, "package require Iwidgets") != TCL_OK) {
+ bu_log("Tcl_Eval ERROR:\n%s\n", Tcl_GetStringResult(interp));
+ return TCL_ERROR;
+ }
+
+ /* Initialize libstruct dm */
+ if (Dm_Init(interp) == TCL_ERROR) {
+ bu_log("Dm_Init ERROR:\n%s\n", Tcl_GetStringResult(interp));
+ return TCL_ERROR;
+ }
+
+ /* Initialize libbu */
+ if (Bu_Init(interp) == TCL_ERROR) {
+ bu_log("Bu_Init ERROR:\n%s\n", Tcl_GetStringResult(interp));
+ return TCL_ERROR;
+ }
+
+ /* Initialize libbn */
+ if (Bn_Init(interp) == TCL_ERROR) {
+ bu_log("Bn_Init ERROR:\n%s\n", Tcl_GetStringResult(interp));
+ return TCL_ERROR;
+ }
+
+ /* Initialize librt */
+ if (Rt_Init(interp) == TCL_ERROR) {
+ bu_log("Rt_Init ERROR:\n%s\n", Tcl_GetStringResult(interp));
+ return TCL_ERROR;
+ }
+
+ /* Initialize the GED object */
+ if (Go_Init(interp) == TCL_ERROR) {
+ bu_log("Go_Init ERROR:\n%s\n", Tcl_GetStringResult(interp));
+ return TCL_ERROR;
+ }
+
+ /* initialize command history objects */
+ Cho_Init(interp);
+
+ Tcl_PkgProvide(interp, "Tclcad", brlcad_version());
+
+ (void)library_initialized(1);
+
+ return TCL_OK;
+}
+
+
/* avoid including itcl.h/itk.h due to their usage of internal headers */
extern int Itcl_Init(Tcl_Interp *);
#ifdef HAVE_TK
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