3 * Vectors and arrays in Tcl
5 * (c) 2003 Mark Wooding
8 /*----- Licensing notice --------------------------------------------------*
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software Foundation,
22 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
32 /*----- Header files ------------------------------------------------------*/
38 /*----- Data structures ---------------------------------------------------*/
40 typedef struct vec_bound
{ long lo
, hi
; } vec_bound
;
49 /*----- Functions provided ------------------------------------------------*/
51 /* --- @vec_find@ --- *
53 * Arguments: @Tcl_Interp *ti@ = interpreter vector exists in
54 * @Tcl_Obj *o@ = object containing the command name
56 * Returns: A pointer to the vector, or null.
58 * Use: Finds the vector with a given name.
61 extern vec
*vec_find(Tcl_Interp */
*ti*/
, Tcl_Obj */
*o*/
);
63 /* --- @vec_index@ --- *
65 * Arguments: @Tcl_Interp *ti@ = interpreter to put errors in
66 * @vec *v@ = the vector
67 * @int objc@ = number of indices provided
68 * @Tcl_Obj *const *objv@ = vector of objects
70 * Returns: Address of the object pointer, or null.
72 * Use: Looks up an index in a vector.
75 extern Tcl_Obj
**vec_index(Tcl_Interp */
*ti*/
, vec */
*v*/
,
76 int /*objc*/, Tcl_Obj
*const */
*objv*/
);
78 /* --- @vec_destroy@ --- *
80 * Arguments: @Tcl_Interp *ti@ = owning interpreter
81 * @vec *v@ = vector pointer
85 * Use: Destroys a vector.
88 extern void vec_destroy(Tcl_Interp */
*ti*/
, vec */
*v*/
);
90 /* --- @vec_create@ --- *
92 * Arguments: @Tcl_Interp *ti@ = interpreter to create vector in
93 * @size_t ndim@ = number of dimensions
94 * @const vec_bound *dim@ = the actual dimensions
95 * @Tcl_Obj *init@ = initial value
97 * Returns: A pointer to the vector, or null if it failed.
99 * Use: Creates a new vector object.
102 extern vec
*vec_create(Tcl_Interp */
*ti*/
, size_t /*ndim*/,
103 const vec_bound */
*dim*/
, Tcl_Obj */
*init*/
);
105 /*----- That's all, folks -------------------------------------------------*/