From ef7a35ca362e47f37aa15c4d164241f84fe538d9 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Fri, 7 Mar 2003 20:04:21 +0000 Subject: [PATCH] Version bump. Organization: Straylight/Edgeware From: mdw --- Makefile | 4 +- vec.h | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 vec.h diff --git a/Makefile b/Makefile index 3a56067..bdcb3e1 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Makefile for RIGHT ON COMMAND-LINE # -# $Id: Makefile,v 1.8 2003/03/07 20:03:01 mdw Exp $ +# $Id: Makefile,v 1.9 2003/03/07 20:04:21 mdw Exp $ #----- Configuration stuff -------------------------------------------------- @@ -30,7 +30,7 @@ RM = rm # Shouldn't need to fiddle with thiis stuff. PACKAGE = rocl -VERSION = 1.1.0 +VERSION = 1.1.1 TCLSCRIPTS = \ elite-editor elite-pairs elite-path elite-find elite-map \ diff --git a/vec.h b/vec.h new file mode 100644 index 0000000..6221ab1 --- /dev/null +++ b/vec.h @@ -0,0 +1,121 @@ +/* -*-c-*- + * + * $Id: vec.h,v 1.1 2003/03/07 20:04:21 mdw Exp $ + * + * Vectors and arrays in Tcl + * + * (c) 2003 Mark Wooding + */ + +/*----- Licensing notice --------------------------------------------------* + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/*----- Revision history --------------------------------------------------* + * + * $Log: vec.h,v $ + * Revision 1.1 2003/03/07 20:04:21 mdw + * Version bump. + * + */ + +#ifndef VEC_H +#define VEC_H + +#ifdef __cplusplus + extern "C" { +#endif + +/*----- Header files ------------------------------------------------------*/ + +#include + +#include + +/*----- Data structures ---------------------------------------------------*/ + +typedef struct vec_bound { long lo, hi; } vec_bound; +typedef struct vec { + Tcl_Command c; + size_t ndim; + vec_bound *dim; + size_t n; + Tcl_Obj **v; +} vec; + +/*----- Functions provided ------------------------------------------------*/ + +/* --- @vec_find@ --- * + * + * Arguments: @Tcl_Interp *ti@ = interpreter vector exists in + * @Tcl_Obj *o@ = object containing the command name + * + * Returns: A pointer to the vector, or null. + * + * Use: Finds the vector with a given name. + */ + +extern vec *vec_find(Tcl_Interp */*ti*/, Tcl_Obj */*o*/); + +/* --- @vec_index@ --- * + * + * Arguments: @Tcl_Interp *ti@ = interpreter to put errors in + * @vec *v@ = the vector + * @int objc@ = number of indices provided + * @Tcl_Obj *const *objv@ = vector of objects + * + * Returns: Address of the object pointer, or null. + * + * Use: Looks up an index in a vector. + */ + +extern Tcl_Obj **vec_index(Tcl_Interp */*ti*/, vec */*v*/, + int /*objc*/, Tcl_Obj *const */*objv*/); + +/* --- @vec_destroy@ --- * + * + * Arguments: @Tcl_Interp *ti@ = owning interpreter + * @vec *v@ = vector pointer + * + * Returns: --- + * + * Use: Destroys a vector. + */ + +extern void vec_destroy(Tcl_Interp */*ti*/, vec */*v*/); + +/* --- @vec_create@ --- * + * + * Arguments: @Tcl_Interp *ti@ = interpreter to create vector in + * @size_t ndim@ = number of dimensions + * @const vec_bound *dim@ = the actual dimensions + * @Tcl_Obj *init@ = initial value + * + * Returns: A pointer to the vector, or null if it failed. + * + * Use: Creates a new vector object. + */ + +extern vec *vec_create(Tcl_Interp */*ti*/, size_t /*ndim*/, + const vec_bound */*dim*/, Tcl_Obj */*init*/); + +/*----- That's all, folks -------------------------------------------------*/ + +#ifdef __cplusplus + } +#endif + +#endif -- [mdw]