BRL-CAD
setup.h
Go to the documentation of this file.
1/* T C L C A D / S E T U P . H
2 * BRL-CAD
3 *
4 * Copyright (c) 2004-2023 United States Government as represented by
5 * the U.S. Army Research Laboratory.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * version 2.1 as published by the Free Software Foundation.
10 *
11 * This library is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this file; see the file named COPYING for more
18 * information.
19 */
20/** @addtogroup libtclcad */
21/** @{ */
22/** @file tclcad/setup.h
23 *
24 * @brief
25 * Setup header file for the BRL-CAD TclCAD Library, LIBTCLCAD.
26 *
27 */
28
29#ifndef TCLCAD_SETUP_H
30#define TCLCAD_SETUP_H
31
32#include "common.h"
33#include "bu/cmd.h"
34#include "bu/process.h"
35#include "tcl.h"
36#include "dm.h"
37#include "tclcad/defines.h"
38
39__BEGIN_DECLS
40
41TCLCAD_EXPORT extern int tclcad_tk_setup(Tcl_Interp *interp);
42TCLCAD_EXPORT extern void tclcad_auto_path(Tcl_Interp *interp);
43TCLCAD_EXPORT extern void tclcad_tcl_library(Tcl_Interp *interp);
44TCLCAD_EXPORT extern void tclcad_bn_setup(Tcl_Interp *interp);
45
46/**
47 * Add all the supported Tcl interfaces to LIBRT routines to the list
48 * of commands known by the given interpreter.
49 *
50 * wdb_open creates database "objects" which appear as Tcl procs,
51 * which respond to many operations.
52 *
53 * The "db rt_gettrees" operation in turn creates a ray-traceable
54 * object as yet another Tcl proc, which responds to additional
55 * operations.
56 *
57 * Note that the MGED mainline C code automatically runs "wdb_open db"
58 * and "wdb_open .inmem" on behalf of the MGED user, which exposes all
59 * of this power.
60 */
61TCLCAD_EXPORT extern void tclcad_rt_setup(Tcl_Interp *interp);
62
63
64/**
65 * Allows LIBRT to be dynamically loaded to a vanilla tclsh/wish with
66 * "load /usr/brlcad/lib/libbu.so"
67 * "load /usr/brlcad/lib/libbn.so"
68 * "load /usr/brlcad/lib/librt.so"
69 */
70TCLCAD_EXPORT extern int Rt_Init(Tcl_Interp *interp);
71
72
73/* defined in cmdhist_obj.c */
74TCLCAD_EXPORT extern int Cho_Init(Tcl_Interp *interp);
75
76/**
77 * Open a command history object.
78 *
79 * USAGE:
80 * ch_open name
81 */
82TCLCAD_EXPORT extern int cho_open_tcl(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv);
83
84
85/**
86 * This is a convenience routine for registering an array of commands
87 * with a Tcl interpreter. Note - this is not intended for use by
88 * commands with associated state (i.e. ClientData). The interp is
89 * passed to the bu_cmdtab function as clientdata instead of the
90 * bu_cmdtab entry.
91 *
92 * @param interp - Tcl interpreter wherein to register the commands
93 * @param cmds - commands and related function pointers
94 */
95TCLCAD_EXPORT extern void tclcad_register_cmds(Tcl_Interp *interp, struct bu_cmdtab *cmds);
96
97
98/**
99 * Set the variables "argc" and "argv" in interp.
100 */
101TCLCAD_EXPORT extern void tclcad_set_argv(Tcl_Interp *interp, int argc, const char **argv);
102
103/**
104 * This is the "all-in-one" initialization intended for use by
105 * applications that are providing a Tcl_Interp and want to initialize
106 * all of the BRL-CAD Tcl/Tk interfaces.
107 *
108 * libbu, libbn, librt, libged, and Itcl are always initialized.
109 *
110 * To initialize graphical elements (Tk/Itk), set init_gui to 1.
111 */
112TCLCAD_EXPORT extern int tclcad_init(Tcl_Interp *interp, int init_gui, struct bu_vls *tlog);
113
114__END_DECLS
115
116#endif /* TCLCAD_SETUP_H */
117
118/** @} */
119/*
120 * Local Variables:
121 * mode: C
122 * tab-width: 8
123 * indent-tabs-mode: t
124 * c-file-style: "stroustrup"
125 * End:
126 * ex: shiftwidth=4 tabstop=8
127 */
Header file for the BRL-CAD common definitions.
int Rt_Init(Tcl_Interp *interp)
int cho_open_tcl(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv)
void tclcad_register_cmds(Tcl_Interp *interp, struct bu_cmdtab *cmds)
int tclcad_init(Tcl_Interp *interp, int init_gui, struct bu_vls *tlog)
void tclcad_bn_setup(Tcl_Interp *interp)
void tclcad_rt_setup(Tcl_Interp *interp)
void tclcad_tcl_library(Tcl_Interp *interp)
int tclcad_tk_setup(Tcl_Interp *interp)
void tclcad_auto_path(Tcl_Interp *interp)
int Cho_Init(Tcl_Interp *interp)
void tclcad_set_argv(Tcl_Interp *interp, int argc, const char **argv)
Definition: cmd.h:47
Definition: vls.h:53
Definitions header file for the BRL-CAD TclCAD Library, LIBTCLCAD.