BRL-CAD
Loading...
Searching...
No Matches
misc.h
Go to the documentation of this file.
1/* T C L C A D / M I S C . H
2 * BRL-CAD
3 *
4 * Copyright (c) 2004-2025 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/misc.h
23 *
24 * @brief
25 * Miscellaneous header file for the BRL-CAD TclCAD Library, LIBTCLCAD.
26 *
27 */
28
29#ifndef TCLCAD_MISC_H
30#define TCLCAD_MISC_H
31
32#include "common.h"
33#include "bu/process.h"
34#include "tcl.h"
35#include "dm.h"
36#include "ged.h"
37#include "tclcad/defines.h"
38
40
42 struct ged *gedp;
45
46 // These are view related, but appear to be intended as global across all
47 // views associated with the gedp - that is why they are here and not in
48 // tclcad_view_data.
52};
53
54struct tclcad_obj {
55 struct bu_list l;
56 struct ged *to_gedp;
58};
59
60#define TCLCAD_OBJ_NULL (struct tclcad_obj *)0
61
63 Tcl_Interp *interp,
64 int argc,
65 const char *const*argv);
66
67/**
68 * Generic interface for the LIBRT_class manipulation routines.
69 *
70 * Usage:
71 * procname dbCmdName ?args?
72 * Returns: result of cmdName LIBRT operation.
73 *
74 * Objects of type 'procname' must have been previously created by the
75 * 'rt_gettrees' operation performed on a database object.
76 *
77 * Example -
78 * .inmem rt_gettrees .rt all.g
79 * .rt shootray {0 0 0} dir {0 0 -1}
80 */
82 Tcl_Interp *interp,
83 int argc,
84 const char **argv);
85
86/************************************************************************************************
87 * *
88 * Tcl interface to the Database *
89 * *
90 ************************************************************************************************/
91
92/**
93 * Given the name of a database object or a full path to a leaf
94 * object, obtain the internal form of that leaf. Packaged separately
95 * mainly to make available nice Tcl error handling.
96 *
97 * Returns -
98 * TCL_OK
99 * TCL_ERROR
100 */
102 struct rt_db_internal *ip,
103 const char *path,
104 struct rt_wdb *wdb);
105
106/**
107 * Expects the Tcl_obj argument (list) to be a Tcl list and extracts
108 * list elements, converts them to int, and stores them in the passed
109 * in array. If the array_len argument is zero, a new array of
110 * appropriate length is allocated. The return value is the number of
111 * elements converted.
112 */
114 Tcl_Obj *list,
115 int **array,
116 int *array_len);
117
118/**
119 * Expects the Tcl_obj argument (list) to be a Tcl list and extracts
120 * list elements, converts them to fastf_t, and stores them in the
121 * passed in array. If the array_len argument is zero, a new array of
122 * appropriate length is allocated. The return value is the number of
123 * elements converted.
124 */
126 Tcl_Obj *list,
127 fastf_t **array,
128 int *array_len);
129
130
131/**
132 * interface to above tcl_obj_to_int_array() routine. This routine
133 * expects a character string instead of a Tcl_Obj.
134 *
135 * Returns the number of elements converted.
136 */
138 char *char_list,
139 int **array,
140 int *array_len);
141
142
143/**
144 * interface to above tcl_obj_to_fastf_array() routine. This routine
145 * expects a character string instead of a Tcl_Obj.
146 *
147 * returns the number of elements converted.
148 */
150 const char *char_list,
151 fastf_t **array,
152 int *array_len);
153
154
155/* defined in tclcad_obj.c */
157 Tcl_Interp *interp,
158 int argc,
159 const char **argv);
161 int argc,
162 const char *argv[]);
163
164/**
165 * Tcl specific I/O handlers
166 */
174TCLCAD_EXPORT void
176
177TCLCAD_EXPORT void
179TCLCAD_EXPORT void
181
183
184#endif /* TCLCAD_MISC_H */
185
186/** @} */
187/*
188 * Local Variables:
189 * mode: C
190 * tab-width: 8
191 * indent-tabs-mode: t
192 * c-file-style: "stroustrup"
193 * End:
194 * ex: shiftwidth=4 tabstop=8
195 */
Definition dvec.h:74
Header file for the BRL-CAD common definitions.
bu_process_io_t
Definition process.h:42
#define UNUSED(parameter)
Definition common.h:335
void(* ged_io_func_t)(void *, int)
Definition defines.h:83
int tclcad_rt(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv)
struct application * to_rt_gettrees_application(struct ged *gedp, int argc, const char *argv[])
void tclcad_delete_io_handler(struct ged_subprocess *p, bu_process_io_t d)
int tcl_obj_to_int_array(Tcl_Interp *interp, Tcl_Obj *list, int **array, int *array_len)
int tclcad_rt_cutter(ClientData clientData, Tcl_Interp *interp, int argc, const char *const *argv)
int tcl_list_to_int_array(Tcl_Interp *interp, char *char_list, int **array, int *array_len)
int tclcad_rt_import_from_path(Tcl_Interp *interp, struct rt_db_internal *ip, const char *path, struct rt_wdb *wdb)
struct tclcad_io_data * tclcad_create_io_data(void)
void tclcad_destroy_io_data(struct tclcad_io_data *d)
void tclcad_create_io_handler(struct ged_subprocess *p, bu_process_io_t d, ged_io_func_t callback, void *data)
int to_open_tcl(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv)
int tcl_list_to_fastf_array(Tcl_Interp *interp, const char *char_list, fastf_t **array, int *array_len)
int tcl_obj_to_fastf_array(Tcl_Interp *interp, Tcl_Obj *list, fastf_t **array, int *array_len)
Definition vls.h:53
Definition defines.h:167
Definition wdb.h:62
struct bu_vls go_rt_end_callback
Definition misc.h:49
int go_more_args_callback_cnt
Definition misc.h:44
struct dm_view_data go_dmv
Definition misc.h:51
struct ged * gedp
Definition misc.h:42
struct bu_vls go_more_args_callback
Definition misc.h:43
int go_rt_end_callback_cnt
Definition misc.h:50
Tcl_Interp * interp
Definition misc.h:168
void * state
Definition misc.h:170
int io_mode
Definition misc.h:169
Tcl_Interp * to_interp
Definition misc.h:57
struct bu_list l
Definition misc.h:55
struct ged * to_gedp
Definition misc.h:56
Definitions header file for the BRL-CAD TclCAD Library, LIBTCLCAD.