3 * $Id: vec.h,v 1.1 2003/03/07 20:04:21 mdw Exp $
5 * Vectors and arrays in Tcl
7 * (c) 2003 Mark Wooding
10 /*----- Licensing notice --------------------------------------------------*
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software Foundation,
24 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 /*----- Revision history --------------------------------------------------*
30 * Revision 1.1 2003/03/07 20:04:21 mdw
42 /*----- Header files ------------------------------------------------------*/
48 /*----- Data structures ---------------------------------------------------*/
50 typedef struct vec_bound
{ long lo
, hi
; } vec_bound
;
59 /*----- Functions provided ------------------------------------------------*/
61 /* --- @vec_find@ --- *
63 * Arguments: @Tcl_Interp *ti@ = interpreter vector exists in
64 * @Tcl_Obj *o@ = object containing the command name
66 * Returns: A pointer to the vector, or null.
68 * Use: Finds the vector with a given name.
71 extern vec
*vec_find(Tcl_Interp */
*ti*/
, Tcl_Obj */
*o*/
);
73 /* --- @vec_index@ --- *
75 * Arguments: @Tcl_Interp *ti@ = interpreter to put errors in
76 * @vec *v@ = the vector
77 * @int objc@ = number of indices provided
78 * @Tcl_Obj *const *objv@ = vector of objects
80 * Returns: Address of the object pointer, or null.
82 * Use: Looks up an index in a vector.
85 extern Tcl_Obj
**vec_index(Tcl_Interp */
*ti*/
, vec */
*v*/
,
86 int /*objc*/, Tcl_Obj
*const */
*objv*/
);
88 /* --- @vec_destroy@ --- *
90 * Arguments: @Tcl_Interp *ti@ = owning interpreter
91 * @vec *v@ = vector pointer
95 * Use: Destroys a vector.
98 extern void vec_destroy(Tcl_Interp */
*ti*/
, vec */
*v*/
);
100 /* --- @vec_create@ --- *
102 * Arguments: @Tcl_Interp *ti@ = interpreter to create vector in
103 * @size_t ndim@ = number of dimensions
104 * @const vec_bound *dim@ = the actual dimensions
105 * @Tcl_Obj *init@ = initial value
107 * Returns: A pointer to the vector, or null if it failed.
109 * Use: Creates a new vector object.
112 extern vec
*vec_create(Tcl_Interp */
*ti*/
, size_t /*ndim*/,
113 const vec_bound */
*dim*/
, Tcl_Obj */
*init*/
);
115 /*----- That's all, folks -------------------------------------------------*/