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.
34 /*----- Header files ------------------------------------------------------*/
40 /*----- Data structures ---------------------------------------------------*/
42 typedef struct vec_bound { long lo, hi; } vec_bound;
51 /*----- Functions provided ------------------------------------------------*/
53 /* --- @vec_find@ --- *
55 * Arguments: @Tcl_Interp *ti@ = interpreter vector exists in
56 * @Tcl_Obj *o@ = object containing the command name
58 * Returns: A pointer to the vector, or null.
60 * Use: Finds the vector with a given name.
63 extern vec *vec_find(Tcl_Interp */*ti*/, Tcl_Obj */*o*/);
65 /* --- @vec_index@ --- *
67 * Arguments: @Tcl_Interp *ti@ = interpreter to put errors in
68 * @vec *v@ = the vector
69 * @int objc@ = number of indices provided
70 * @Tcl_Obj *const *objv@ = vector of objects
72 * Returns: Address of the object pointer, or null.
74 * Use: Looks up an index in a vector.
77 extern Tcl_Obj **vec_index(Tcl_Interp */*ti*/, vec */*v*/,
78 int /*objc*/, Tcl_Obj *const */*objv*/);
80 /* --- @vec_destroy@ --- *
82 * Arguments: @Tcl_Interp *ti@ = owning interpreter
83 * @vec *v@ = vector pointer
87 * Use: Destroys a vector.
90 extern void vec_destroy(Tcl_Interp */*ti*/, vec */*v*/);
92 /* --- @vec_create@ --- *
94 * Arguments: @Tcl_Interp *ti@ = interpreter to create vector in
95 * @size_t ndim@ = number of dimensions
96 * @const vec_bound *dim@ = the actual dimensions
97 * @Tcl_Obj *init@ = initial value
99 * Returns: A pointer to the vector, or null if it failed.
101 * Use: Creates a new vector object.
104 extern vec *vec_create(Tcl_Interp */*ti*/, size_t /*ndim*/,
105 const vec_bound */*dim*/, Tcl_Obj */*init*/);
107 /*----- That's all, folks -------------------------------------------------*/