summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoye <joye>2014-07-08 19:55:45 (GMT)
committerjoye <joye>2014-07-08 19:55:45 (GMT)
commitd94450a5cfe4e5e7117cdc87e20d906f843e9990 (patch)
tree0855ba38b4c83cbfe50b485b22a845294e3f6bd4
parentd9392c93890e89f29b64c963e8ff39c6e8d402a9 (diff)
downloadblt-d94450a5cfe4e5e7117cdc87e20d906f843e9990.zip
blt-d94450a5cfe4e5e7117cdc87e20d906f843e9990.tar.gz
blt-d94450a5cfe4e5e7117cdc87e20d906f843e9990.tar.bz2
*** empty log message ***
-rw-r--r--src/bltGrText.C2
-rw-r--r--src/bltNsUtil.C13
-rw-r--r--src/bltNsUtil.h31
-rw-r--r--src/bltOp.C4
-rw-r--r--src/bltOp.h23
-rw-r--r--src/bltParse.C12
-rw-r--r--src/bltParse.h25
-rw-r--r--src/bltSwitch.C6
-rw-r--r--src/bltSwitch.h150
-rw-r--r--src/bltVecCmd.C902
-rw-r--r--src/bltVecInt.h246
-rw-r--r--src/bltVecMath.C71
-rw-r--r--src/bltVector.C224
-rw-r--r--src/bltVector.h37
14 files changed, 603 insertions, 1143 deletions
diff --git a/src/bltGrText.C b/src/bltGrText.C
index 8e64606..62fd96a 100644
--- a/src/bltGrText.C
+++ b/src/bltGrText.C
@@ -29,11 +29,9 @@
#include <math.h>
-//extern "C" {
#include <tk.h>
#include <tkPort.h>
#include <tkInt.h>
-//};
#include "bltGrText.h"
#include "bltGraph.h"
diff --git a/src/bltNsUtil.C b/src/bltNsUtil.C
index 97f132d..10918ac 100644
--- a/src/bltNsUtil.C
+++ b/src/bltNsUtil.C
@@ -29,15 +29,18 @@
#include <tclPort.h>
#include <tclInt.h>
+
#include "bltNsUtil.h"
-Tcl_Namespace* Blt_GetCommandNamespace(Tcl_Command cmdToken)
+using namespace Blt;
+
+Tcl_Namespace* Blt::GetCommandNamespace(Tcl_Command cmdToken)
{
Command* cmdPtr = (Command*)cmdToken;
return (Tcl_Namespace *)cmdPtr->nsPtr;
}
-int Blt_ParseObjectName(Tcl_Interp* interp, const char *path,
+int Blt::ParseObjectName(Tcl_Interp* interp, const char *path,
Blt_ObjectName *namePtr, unsigned int flags)
{
namePtr->nsPtr = NULL;
@@ -78,7 +81,7 @@ int Blt_ParseObjectName(Tcl_Interp* interp, const char *path,
return 1;
}
-char* Blt_MakeQualifiedName(Blt_ObjectName *namePtr, Tcl_DString *resultPtr)
+char* Blt::MakeQualifiedName(Blt_ObjectName *namePtr, Tcl_DString *resultPtr)
{
Tcl_DStringInit(resultPtr);
if ((namePtr->nsPtr->fullName[0] != ':') ||
@@ -103,10 +106,10 @@ static Tcl_Namespace* NamespaceOfVariable(Var *varPtr)
return NULL;
}
-Tcl_Namespace* Blt_GetVariableNamespace(Tcl_Interp* interp, const char *path)
+Tcl_Namespace* Blt::GetVariableNamespace(Tcl_Interp* interp, const char *path)
{
Blt_ObjectName objName;
- if (!Blt_ParseObjectName(interp, path, &objName, BLT_NO_DEFAULT_NS))
+ if (!ParseObjectName(interp, path, &objName, BLT_NO_DEFAULT_NS))
return NULL;
if (objName.nsPtr == NULL) {
diff --git a/src/bltNsUtil.h b/src/bltNsUtil.h
index 5b9bb28..950a48a 100644
--- a/src/bltNsUtil.h
+++ b/src/bltNsUtil.h
@@ -38,26 +38,27 @@
#define NS_SEARCH_GLOBAL (1<<1)
#define NS_SEARCH_BOTH (NS_SEARCH_GLOBAL | NS_SEARCH_CURRENT)
-typedef struct {
- const char *name;
- Tcl_Namespace *nsPtr;
-} Blt_ObjectName;
-
#define BLT_NO_DEFAULT_NS (1<<0)
#define BLT_NO_ERROR_MSG (1<<1)
-/*
- * Auxillary procedures
- */
-extern Tcl_Namespace *Blt_GetVariableNamespace(Tcl_Interp* interp,
- const char *varName);
+namespace Blt {
+
+ typedef struct {
+ const char *name;
+ Tcl_Namespace *nsPtr;
+ } Blt_ObjectName;
+
+ extern Tcl_Namespace* GetVariableNamespace(Tcl_Interp* interp,
+ const char *varName);
-extern Tcl_Namespace *Blt_GetCommandNamespace(Tcl_Command cmdToken);
+ extern Tcl_Namespace* GetCommandNamespace(Tcl_Command cmdToken);
-extern int Blt_ParseObjectName(Tcl_Interp* interp, const char *name,
- Blt_ObjectName *objNamePtr, unsigned int flags);
+ extern int ParseObjectName(Tcl_Interp* interp, const char *name,
+ Blt_ObjectName *objNamePtr,
+ unsigned int flags);
-extern char *Blt_MakeQualifiedName(Blt_ObjectName *objNamePtr,
- Tcl_DString *resultPtr);
+ extern char* MakeQualifiedName(Blt_ObjectName *objNamePtr,
+ Tcl_DString *resultPtr);
+};
#endif /* BLT_NS_UTIL_H */
diff --git a/src/bltOp.C b/src/bltOp.C
index b4a9d7e..d52c133 100644
--- a/src/bltOp.C
+++ b/src/bltOp.C
@@ -31,6 +31,8 @@
#include "bltOp.h"
+using namespace Blt;
+
static int BinaryOpSearch(Blt_OpSpec *specs, int nSpecs, const char *string,
int length)
{
@@ -90,7 +92,7 @@ static int LinearOpSearch(Blt_OpSpec *specs, int nSpecs, const char *string,
return last; /* Op found. */
}
-void* Blt_GetOpFromObj(Tcl_Interp* interp, int nSpecs, Blt_OpSpec *specs,
+void* Blt::GetOpFromObj(Tcl_Interp* interp, int nSpecs, Blt_OpSpec *specs,
int operPos, int objc, Tcl_Obj* const objv[],
int flags)
{
diff --git a/src/bltOp.h b/src/bltOp.h
index 2311714..fc9ffb7 100644
--- a/src/bltOp.h
+++ b/src/bltOp.h
@@ -35,30 +35,33 @@
#include <tk.h>
-typedef struct {
+#define BLT_OP_BINARY_SEARCH 0
+#define BLT_OP_LINEAR_SEARCH 1
+
+namespace Blt {
+
+ typedef struct {
const char *name; /* Name of operation */
int minChars; /* Minimum # characters to disambiguate */
void *proc;
int minArgs; /* Minimum # args required */
int maxArgs; /* Maximum # args required */
const char *usage; /* Usage message */
-} Blt_OpSpec;
+ } Blt_OpSpec;
-typedef enum {
+ typedef enum {
BLT_OP_ARG0, /* Op is the first argument. */
BLT_OP_ARG1, /* Op is the second argument. */
BLT_OP_ARG2, /* Op is the third argument. */
BLT_OP_ARG3, /* Op is the fourth argument. */
BLT_OP_ARG4 /* Op is the fifth argument. */
-} Blt_OpIndex;
-
-#define BLT_OP_BINARY_SEARCH 0
-#define BLT_OP_LINEAR_SEARCH 1
+ } Blt_OpIndex;
-void *Blt_GetOpFromObj(Tcl_Interp* interp, int nSpecs,
- Blt_OpSpec *specs, int operPos, int objc,
- Tcl_Obj* const objv[], int flags);
+ void *GetOpFromObj(Tcl_Interp* interp, int nSpecs,
+ Blt_OpSpec *specs, int operPos, int objc,
+ Tcl_Obj* const objv[], int flags);
+};
#endif
diff --git a/src/bltParse.C b/src/bltParse.C
index 14fb262..111a6bc 100644
--- a/src/bltParse.C
+++ b/src/bltParse.C
@@ -35,6 +35,8 @@ using namespace std;
#include "bltParse.h"
+using namespace Blt;
+
/*
* A table used to classify input characters to assist in parsing
* TCL commands. The table should be indexed with a signed character
@@ -184,14 +186,14 @@ static unsigned char tclTypeTable[] =
#define CHAR_TYPE(src,last) \
(((src)==(last))?TCL_COMMAND_END:(tclTypeTable+128)[(int)*(src)])
-int Blt_ParseNestedCmd(Tcl_Interp* interp, const char *string,
+int Blt::ParseNestedCmd(Tcl_Interp* interp, const char *string,
int flags, const char **termPtr, ParseValue *parsePtr)
{
return TCL_ERROR;
}
-int Blt_ParseBraces(Tcl_Interp* interp, const char *string,
+int Blt::ParseBraces(Tcl_Interp* interp, const char *string,
const char **termPtr, ParseValue *parsePtr)
{
int level;
@@ -273,7 +275,7 @@ int Blt_ParseBraces(Tcl_Interp* interp, const char *string,
return TCL_OK;
}
-void Blt_ExpandParseValue(ParseValue *parsePtr, int needed)
+void Blt::ExpandParseValue(ParseValue *parsePtr, int needed)
{
/*
@@ -303,7 +305,7 @@ void Blt_ExpandParseValue(ParseValue *parsePtr, int needed)
parsePtr->clientData = (ClientData)1;
}
-int Blt_ParseQuotes(Tcl_Interp* interp, const char *string, int termChar,
+int Blt::ParseQuotes(Tcl_Interp* interp, const char *string, int termChar,
int flags, const char **termPtr, ParseValue *parsePtr)
{
const char *src;
@@ -356,7 +358,7 @@ int Blt_ParseQuotes(Tcl_Interp* interp, const char *string, int termChar,
int result;
parsePtr->next = dest;
- result = Blt_ParseNestedCmd(interp, src, flags, termPtr, parsePtr);
+ result = ParseNestedCmd(interp, src, flags, termPtr, parsePtr);
if (result != TCL_OK) {
return result;
}
diff --git a/src/bltParse.h b/src/bltParse.h
index b9cb298..ee215a5 100644
--- a/src/bltParse.h
+++ b/src/bltParse.h
@@ -30,21 +30,26 @@
#ifndef _BLT_PARSE_H
#define _BLT_PARSE_H
-typedef struct _ParseValue ParseValue;
-struct _ParseValue {
+namespace Blt {
+
+ typedef struct _ParseValue ParseValue;
+ struct _ParseValue {
char *buffer;
char *next;
char *end;
void (*expandProc)(ParseValue *pvPtr, int needed);
ClientData clientData;
-};
+ };
-extern int Blt_ParseBraces(Tcl_Interp* interp, const char *string,
- const char **termPtr, ParseValue *pvPtr);
-extern int Blt_ParseNestedCmd(Tcl_Interp* interp, const char *string,
- int flags, const char **termPtr, ParseValue *pvPtr);
-extern int Blt_ParseQuotes(Tcl_Interp* interp, const char *string,
- int termChar, int flags, const char **termPtr, ParseValue * pvPtr);
-extern void Blt_ExpandParseValue(ParseValue *pvPtr, int needed);
+ extern int ParseBraces(Tcl_Interp* interp, const char *string,
+ const char **termPtr, ParseValue *pvPtr);
+ extern int ParseNestedCmd(Tcl_Interp* interp, const char *string,
+ int flags, const char **termPtr,
+ ParseValue *pvPtr);
+ extern int ParseQuotes(Tcl_Interp* interp, const char *string,
+ int termChar, int flags, const char **termPtr,
+ ParseValue * pvPtr);
+ extern void ExpandParseValue(ParseValue *pvPtr, int needed);
+}
#endif
diff --git a/src/bltSwitch.C b/src/bltSwitch.C
index bb4a62f..291d232 100644
--- a/src/bltSwitch.C
+++ b/src/bltSwitch.C
@@ -39,6 +39,8 @@ using namespace std;
#include "bltSwitch.h"
+using namespace Blt;
+
#define COUNT_NNEG 0
#define COUNT_POS 1
#define COUNT_ANY 2
@@ -295,7 +297,7 @@ static int DoSwitch(Tcl_Interp* interp, Blt_SwitchSpec *sp,
return TCL_OK;
}
-int Blt_ParseSwitches(Tcl_Interp* interp, Blt_SwitchSpec *specs,
+int Blt::ParseSwitches(Tcl_Interp* interp, Blt_SwitchSpec *specs,
int objc, Tcl_Obj* const objv[], void *record,
int flags)
{
@@ -372,7 +374,7 @@ int Blt_ParseSwitches(Tcl_Interp* interp, Blt_SwitchSpec *specs,
return count;
}
-void Blt_FreeSwitches(Blt_SwitchSpec *specs, void *record, int needFlags)
+void Blt::FreeSwitches(Blt_SwitchSpec *specs, void *record, int needFlags)
{
for (Blt_SwitchSpec *sp = specs; sp->type != BLT_SWITCH_END; sp++) {
if ((sp->flags & needFlags) == needFlags) {
diff --git a/src/bltSwitch.h b/src/bltSwitch.h
index dab5e37..eed7b31 100644
--- a/src/bltSwitch.h
+++ b/src/bltSwitch.h
@@ -33,95 +33,97 @@
#ifndef BLT_SWITCH_H
#define BLT_SWITCH_H
-# include <stddef.h>
+#include <stddef.h>
-typedef int (Blt_SwitchParseProc)(ClientData clientData, Tcl_Interp* interp,
- const char *switchName, Tcl_Obj *valueObjPtr, char *record, int offset,
- int flags);
-typedef void (Blt_SwitchFreeProc)(char *record, int offset, int flags);
+#define BLT_SWITCH_DEFAULTS (0)
+#define BLT_SWITCH_ARGV_PARTIAL (1<<1)
+#define BLT_SWITCH_OBJV_PARTIAL (1<<1)
-typedef struct {
- Blt_SwitchParseProc *parseProc; /* Procedure to parse a switch
- * value and store it in its *
- * converted form in the data *
- * record. */
+ /*
+ * Possible flag values for Blt_SwitchSpec structures. Any bits at or
+ * above BLT_SWITCH_USER_BIT may be used by clients for selecting
+ * certain entries.
+ */
+#define BLT_SWITCH_NULL_OK (1<<0)
+#define BLT_SWITCH_DONT_SET_DEFAULT (1<<3)
+#define BLT_SWITCH_SPECIFIED (1<<4)
+#define BLT_SWITCH_USER_BIT (1<<8)
- Blt_SwitchFreeProc *freeProc; /* Procedure to free a switch. */
+namespace Blt {
- ClientData clientData; /* Arbitrary one-word value used by
- * switch parser, passed to
- * parseProc. */
-} Blt_SwitchCustom;
+ typedef int (Blt_SwitchParseProc)(ClientData clientData, Tcl_Interp* interp,
+ const char *switchName,
+ Tcl_Obj *valueObjPtr, char *record,
+ int offset, int flags);
+ typedef void (Blt_SwitchFreeProc)(char *record, int offset, int flags);
+ typedef struct {
+ Blt_SwitchParseProc *parseProc; /* Procedure to parse a switch
+ * value and store it in its *
+ * converted form in the data *
+ * record. */
-/*
- * Type values for Blt_SwitchSpec structures. See the user
- * documentation for details.
- */
-typedef enum {
- BLT_SWITCH_BOOLEAN,
- BLT_SWITCH_DOUBLE,
- BLT_SWITCH_BITMASK,
- BLT_SWITCH_BITMASK_INVERT,
- BLT_SWITCH_FLOAT,
- BLT_SWITCH_INT,
- BLT_SWITCH_INT_NNEG,
- BLT_SWITCH_INT_POS,
- BLT_SWITCH_LIST,
- BLT_SWITCH_LONG,
- BLT_SWITCH_LONG_NNEG,
- BLT_SWITCH_LONG_POS,
- BLT_SWITCH_OBJ,
- BLT_SWITCH_STRING,
- BLT_SWITCH_VALUE,
- BLT_SWITCH_CUSTOM,
- BLT_SWITCH_END
-} Blt_SwitchTypes;
-
-
-typedef struct {
- Blt_SwitchTypes type; /* Type of option, such as
- * BLT_SWITCH_COLOR; see definitions
- * below. Last option in table must
- * have type BLT_SWITCH_END. */
-
- const char *switchName; /* Switch used to specify option in
+ Blt_SwitchFreeProc *freeProc; /* Procedure to free a switch. */
+
+ ClientData clientData; /* Arbitrary one-word value used by
+ * switch parser, passed to
+ * parseProc. */
+ } Blt_SwitchCustom;
+
+ /*
+ * Type values for Blt_SwitchSpec structures. See the user
+ * documentation for details.
+ */
+ typedef enum {
+ BLT_SWITCH_BOOLEAN,
+ BLT_SWITCH_DOUBLE,
+ BLT_SWITCH_BITMASK,
+ BLT_SWITCH_BITMASK_INVERT,
+ BLT_SWITCH_FLOAT,
+ BLT_SWITCH_INT,
+ BLT_SWITCH_INT_NNEG,
+ BLT_SWITCH_INT_POS,
+ BLT_SWITCH_LIST,
+ BLT_SWITCH_LONG,
+ BLT_SWITCH_LONG_NNEG,
+ BLT_SWITCH_LONG_POS,
+ BLT_SWITCH_OBJ,
+ BLT_SWITCH_STRING,
+ BLT_SWITCH_VALUE,
+ BLT_SWITCH_CUSTOM,
+ BLT_SWITCH_END
+ } Blt_SwitchTypes;
+
+ typedef struct {
+ Blt_SwitchTypes type; /* Type of option, such as
+ * BLT_SWITCH_COLOR; see definitions
+ * below. Last option in table must
+ * have type BLT_SWITCH_END. */
+
+ const char *switchName; /* Switch used to specify option in
* argv. NULL means this spec is part
* of a group. */
- const char *help; /* Help string. */
- int offset; /* Where in widget record to store
+ const char *help; /* Help string. */
+ int offset; /* Where in widget record to store
* value; use Blt_Offset macro to
* generate values for this. */
- int flags; /* Any combination of the values
+ int flags; /* Any combination of the values
* defined below. */
- unsigned int mask;
-
- Blt_SwitchCustom *customPtr; /* If type is BLT_SWITCH_CUSTOM then
- * this is a pointer to info about how
- * to parse and print the option.
- * Otherwise it is irrelevant. */
-} Blt_SwitchSpec;
-
-#define BLT_SWITCH_DEFAULTS (0)
-#define BLT_SWITCH_ARGV_PARTIAL (1<<1)
-#define BLT_SWITCH_OBJV_PARTIAL (1<<1)
-
-/*
- * Possible flag values for Blt_SwitchSpec structures. Any bits at or
- * above BLT_SWITCH_USER_BIT may be used by clients for selecting
- * certain entries.
- */
-#define BLT_SWITCH_NULL_OK (1<<0)
-#define BLT_SWITCH_DONT_SET_DEFAULT (1<<3)
-#define BLT_SWITCH_SPECIFIED (1<<4)
-#define BLT_SWITCH_USER_BIT (1<<8)
+ unsigned int mask;
-extern int Blt_ParseSwitches(Tcl_Interp* interp, Blt_SwitchSpec *specPtr,
- int objc, Tcl_Obj *const *objv, void *rec, int flags);
+ Blt_SwitchCustom *customPtr; /* If type is BLT_SWITCH_CUSTOM then
+ * this is a pointer to info about how
+ * to parse and print the option.
+ * Otherwise it is irrelevant. */
+ } Blt_SwitchSpec;
-extern void Blt_FreeSwitches(Blt_SwitchSpec *specs, void *rec, int flags);
+ extern int ParseSwitches(Tcl_Interp* interp, Blt_SwitchSpec *specPtr,
+ int objc, Tcl_Obj *const *objv, void *rec,
+ int flags);
+ extern void FreeSwitches(Blt_SwitchSpec *specs, void *rec, int flags);
+};
#endif /* BLT_SWITCH_H */
diff --git a/src/bltVecCmd.C b/src/bltVecCmd.C
index dda383e..67562e5 100644
--- a/src/bltVecCmd.C
+++ b/src/bltVecCmd.C
@@ -57,6 +57,8 @@
#include "bltNsUtil.h"
#include "bltSwitch.h"
+using namespace Blt;
+
extern int Blt_SimplifyLine (Point2d *origPts, int low, int high,
double tolerance, int *indices);
@@ -162,28 +164,9 @@ static int Blt_ExprDoubleFromObj(Tcl_Interp* interp, Tcl_Obj *objPtr, double *va
return TCL_ERROR;
}
-/*
- *---------------------------------------------------------------------------
- *
- * ObjToFFTVector --
- *
- * Convert a string representing a vector into its vector structure.
- *
- * Results:
- * The return value is a standard TCL result.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-ObjToFFTVector(
- ClientData clientData, /* Not used. */
- Tcl_Interp* interp, /* Interpreter to send results back to */
- const char *switchName, /* Not used. */
- Tcl_Obj *objPtr, /* Name of vector. */
- char *record, /* Structure record */
- int offset, /* Offset to field in structure */
- int flags) /* Not used. */
+static int ObjToFFTVector(ClientData clientData, Tcl_Interp* interp,
+ const char *switchName, Tcl_Obj *objPtr,
+ char *record, int offset, int flags)
{
FFTData *dataPtr = (FFTData *)record;
Vector *vPtr;
@@ -192,7 +175,7 @@ ObjToFFTVector(
char *string;
string = Tcl_GetString(objPtr);
- vPtr = Blt_Vec_Create(dataPtr->dataPtr, string, string, string, &isNew);
+ vPtr = Vec_Create(dataPtr->dataPtr, string, string, string, &isNew);
if (vPtr == NULL) {
return TCL_ERROR;
}
@@ -200,35 +183,15 @@ ObjToFFTVector(
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * ObjToIndex --
- *
- * Convert a string representing a vector into its vector structure.
- *
- * Results:
- * The return value is a standard TCL result.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-ObjToIndex(
- ClientData clientData, /* Contains the vector in question to verify
- * its length. */
- Tcl_Interp* interp, /* Interpreter to send results back to */
- const char *switchName, /* Not used. */
- Tcl_Obj *objPtr, /* Name of vector. */
- char *record, /* Structure record */
- int offset, /* Offset to field in structure */
- int flags) /* Not used. */
+static int ObjToIndex(ClientData clientData, Tcl_Interp* interp,
+ const char *switchName, Tcl_Obj *objPtr, char *record,
+ int offset, int flags)
{
Vector *vPtr = (Vector*)clientData;
int *indexPtr = (int *)(record + offset);
int index;
- if (Blt_Vec_GetIndex(interp, vPtr, Tcl_GetString(objPtr), &index,
+ if (Vec_GetIndex(interp, vPtr, Tcl_GetString(objPtr), &index,
INDEX_CHECK, (Blt_VectorIndexProc **)NULL) != TCL_OK) {
return TCL_ERROR;
}
@@ -237,8 +200,7 @@ ObjToIndex(
}
-static Tcl_Obj *
-GetValues(Vector *vPtr, int first, int last)
+static Tcl_Obj* GetValues(Vector *vPtr, int first, int last)
{
Tcl_Obj *listObjPtr;
double *vp, *vend;
@@ -252,8 +214,7 @@ GetValues(Vector *vPtr, int first, int last)
return listObjPtr;
}
-static void
-ReplicateValue(Vector *vPtr, int first, int last, double value)
+static void ReplicateValue(Vector *vPtr, int first, int last, double value)
{
double *vp, *vend;
@@ -264,19 +225,19 @@ ReplicateValue(Vector *vPtr, int first, int last, double value)
vPtr->notifyFlags |= UPDATE_RANGE;
}
-static int
-CopyList(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int CopyList(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
int i;
- if (Blt_Vec_SetLength(interp, vPtr, objc) != TCL_OK) {
+ if (Vec_SetLength(interp, vPtr, objc) != TCL_OK) {
return TCL_ERROR;
}
for (i = 0; i < objc; i++) {
double value;
if (Blt_ExprDoubleFromObj(interp, objv[i], &value) != TCL_OK) {
- Blt_Vec_SetLength(interp, vPtr, i);
+ Vec_SetLength(interp, vPtr, i);
return TCL_ERROR;
}
vPtr->valueArr[i] = value;
@@ -284,15 +245,14 @@ CopyList(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
return TCL_OK;
}
-static int
-AppendVector(Vector *destPtr, Vector *srcPtr)
+static int AppendVector(Vector *destPtr, Vector *srcPtr)
{
size_t nBytes;
size_t oldSize, newSize;
oldSize = destPtr->length;
newSize = oldSize + srcPtr->last - srcPtr->first + 1;
- if (Blt_Vec_ChangeLength(destPtr->interp, destPtr, newSize) != TCL_OK) {
+ if (Vec_ChangeLength(destPtr->interp, destPtr, newSize) != TCL_OK) {
return TCL_ERROR;
}
nBytes = (newSize - oldSize) * sizeof(double);
@@ -302,8 +262,7 @@ AppendVector(Vector *destPtr, Vector *srcPtr)
return TCL_OK;
}
-static int
-AppendList(Vector *vPtr, int objc, Tcl_Obj* const objv[])
+static int AppendList(Vector *vPtr, int objc, Tcl_Obj* const objv[])
{
Tcl_Interp* interp = vPtr->interp;
int count;
@@ -312,13 +271,13 @@ AppendList(Vector *vPtr, int objc, Tcl_Obj* const objv[])
int oldSize;
oldSize = vPtr->length;
- if (Blt_Vec_ChangeLength(interp, vPtr, vPtr->length + objc) != TCL_OK) {
+ if (Vec_ChangeLength(interp, vPtr, vPtr->length + objc) != TCL_OK) {
return TCL_ERROR;
}
count = oldSize;
for (i = 0; i < objc; i++) {
if (Blt_ExprDoubleFromObj(interp, objv[i], &value) != TCL_OK) {
- Blt_Vec_ChangeLength(interp, vPtr, count);
+ Vec_ChangeLength(interp, vPtr, count);
return TCL_ERROR;
}
vPtr->valueArr[count++] = value;
@@ -327,35 +286,17 @@ AppendList(Vector *vPtr, int objc, Tcl_Obj* const objv[])
return TCL_OK;
}
-/* Vector instance option commands */
+// Vector instance option commands
-/*
- *---------------------------------------------------------------------------
- *
- * AppendOp --
- *
- * Appends one of more TCL lists of values, or vector objects onto the
- * end of the current vector object.
- *
- * Results:
- * A standard TCL result. If a current vector can't be created,
- * resized, any of the named vectors can't be found, or one of lists of
- * values is invalid, TCL_ERROR is returned.
- *
- * Side Effects:
- * Clients of current vector will be notified of the change.
- *
- *---------------------------------------------------------------------------
- */
-static int
-AppendOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int AppendOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
int i;
int result;
Vector *v2Ptr;
for (i = 2; i < objc; i++) {
- v2Ptr = Blt_Vec_ParseElement((Tcl_Interp *)NULL, vPtr->dataPtr,
+ v2Ptr = Vec_ParseElement((Tcl_Interp *)NULL, vPtr->dataPtr,
Tcl_GetString(objv[i]), (const char **)NULL, NS_SEARCH_BOTH);
if (v2Ptr != NULL) {
result = AppendVector(vPtr, v2Ptr);
@@ -375,59 +316,22 @@ AppendOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
}
if (objc > 2) {
if (vPtr->flush) {
- Blt_Vec_FlushCache(vPtr);
+ Vec_FlushCache(vPtr);
}
- Blt_Vec_UpdateClients(vPtr);
+ Vec_UpdateClients(vPtr);
}
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * ClearOp --
- *
- * Deletes all the accumulated array indices for the TCL array associated
- * will the vector. This routine can be used to free excess memory from
- * a large vector.
- *
- * Results:
- * Always returns TCL_OK.
- *
- * Side Effects:
- * Memory used for the entries of the TCL array variable is freed.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-ClearOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int ClearOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
- Blt_Vec_FlushCache(vPtr);
+ Vec_FlushCache(vPtr);
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * DeleteOp --
- *
- * Deletes the given indices from the vector. If no indices are provided
- * the entire vector is deleted.
- *
- * Results:
- * A standard TCL result. If any of the given indices is invalid,
- * interp->result will an error message and TCL_ERROR is returned.
- *
- * Side Effects:
- * The clients of the vector will be notified of the vector
- * deletions.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-DeleteOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int DeleteOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
unsigned char *unsetArr;
int i, j;
@@ -436,7 +340,7 @@ DeleteOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
/* FIXME: Don't delete vector with no indices. */
if (objc == 2) {
- Blt_Vec_Free(vPtr);
+ Vec_Free(vPtr);
return TCL_OK;
}
@@ -449,7 +353,7 @@ DeleteOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
for (i = 2; i < objc; i++) {
string = Tcl_GetString(objv[i]);
- if (Blt_Vec_GetIndexRange(interp, vPtr, string,
+ if (Vec_GetIndexRange(interp, vPtr, string,
(INDEX_COLON | INDEX_CHECK), (Blt_VectorIndexProc **) NULL)
!= TCL_OK) {
free(unsetArr);
@@ -472,31 +376,14 @@ DeleteOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
free(unsetArr);
vPtr->length = count;
if (vPtr->flush) {
- Blt_Vec_FlushCache(vPtr);
+ Vec_FlushCache(vPtr);
}
- Blt_Vec_UpdateClients(vPtr);
+ Vec_UpdateClients(vPtr);
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * DupOp --
- *
- * Creates one or more duplicates of the vector object.
- *
- * Results:
- * A standard TCL result. If a new vector can't be created,
- * or and existing vector resized, TCL_ERROR is returned.
- *
- * Side Effects:
- * Clients of existing vectors will be notified of the change.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-DupOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int DupOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
int i;
@@ -506,33 +393,28 @@ DupOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
int isNew;
name = Tcl_GetString(objv[i]);
- v2Ptr = Blt_Vec_Create(vPtr->dataPtr, name, name, name, &isNew);
+ v2Ptr = Vec_Create(vPtr->dataPtr, name, name, name, &isNew);
if (v2Ptr == NULL) {
return TCL_ERROR;
}
if (v2Ptr == vPtr) {
continue;
}
- if (Blt_Vec_Duplicate(v2Ptr, vPtr) != TCL_OK) {
+ if (Vec_Duplicate(v2Ptr, vPtr) != TCL_OK) {
return TCL_ERROR;
}
if (!isNew) {
if (v2Ptr->flush) {
- Blt_Vec_FlushCache(v2Ptr);
+ Vec_FlushCache(v2Ptr);
}
- Blt_Vec_UpdateClients(v2Ptr);
+ Vec_UpdateClients(v2Ptr);
}
}
return TCL_OK;
}
-
-/* spinellia@acm.org START */
-
-/* fft implementation */
-/*ARGSUSED*/
-static int
-FFTOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int FFTOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
Vector *v2Ptr = NULL;
int isNew;
@@ -543,7 +425,7 @@ FFTOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
data.delta = 1.0;
realVecName = Tcl_GetString(objv[2]);
- v2Ptr = Blt_Vec_Create(vPtr->dataPtr, realVecName, realVecName,
+ v2Ptr = Vec_Create(vPtr->dataPtr, realVecName, realVecName,
realVecName, &isNew);
if (v2Ptr == NULL) {
return TCL_ERROR;
@@ -553,39 +435,38 @@ FFTOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
" can't be the same as the source", (char *)NULL);
return TCL_ERROR;
}
- if (Blt_ParseSwitches(interp, fftSwitches, objc - 3, objv + 3, &data,
+ if (ParseSwitches(interp, fftSwitches, objc - 3, objv + 3, &data,
BLT_SWITCH_DEFAULTS) < 0) {
return TCL_ERROR;
}
- if (Blt_Vec_FFT(interp, v2Ptr, data.imagPtr, data.freqPtr, data.delta,
+ if (Vec_FFT(interp, v2Ptr, data.imagPtr, data.freqPtr, data.delta,
data.mask, vPtr) != TCL_OK) {
return TCL_ERROR;
}
/* Update bookkeeping. */
if (!isNew) {
if (v2Ptr->flush) {
- Blt_Vec_FlushCache(v2Ptr);
+ Vec_FlushCache(v2Ptr);
}
- Blt_Vec_UpdateClients(v2Ptr);
+ Vec_UpdateClients(v2Ptr);
}
if (data.imagPtr != NULL) {
if (data.imagPtr->flush) {
- Blt_Vec_FlushCache(data.imagPtr);
+ Vec_FlushCache(data.imagPtr);
}
- Blt_Vec_UpdateClients(data.imagPtr);
+ Vec_UpdateClients(data.imagPtr);
}
if (data.freqPtr != NULL) {
if (data.freqPtr->flush) {
- Blt_Vec_FlushCache(data.freqPtr);
+ Vec_FlushCache(data.freqPtr);
}
- Blt_Vec_UpdateClients(data.freqPtr);
+ Vec_UpdateClients(data.freqPtr);
}
return TCL_OK;
}
-/*ARGSUSED*/
-static int
-InverseFFTOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int InverseFFTOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
int isNew;
char *name;
@@ -594,54 +475,38 @@ InverseFFTOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
Vector *destImagPtr;
name = Tcl_GetString(objv[2]);
- if (Blt_Vec_LookupName(vPtr->dataPtr, name, &srcImagPtr) != TCL_OK ) {
+ if (Vec_LookupName(vPtr->dataPtr, name, &srcImagPtr) != TCL_OK ) {
return TCL_ERROR;
}
name = Tcl_GetString(objv[3]);
- destRealPtr = Blt_Vec_Create(vPtr->dataPtr, name, name, name, &isNew);
+ destRealPtr = Vec_Create(vPtr->dataPtr, name, name, name, &isNew);
name = Tcl_GetString(objv[4]);
- destImagPtr = Blt_Vec_Create(vPtr->dataPtr, name, name, name, &isNew);
+ destImagPtr = Vec_Create(vPtr->dataPtr, name, name, name, &isNew);
- if (Blt_Vec_InverseFFT(interp, srcImagPtr, destRealPtr, destImagPtr, vPtr)
+ if (Vec_InverseFFT(interp, srcImagPtr, destRealPtr, destImagPtr, vPtr)
!= TCL_OK ){
return TCL_ERROR;
}
if (destRealPtr->flush) {
- Blt_Vec_FlushCache(destRealPtr);
+ Vec_FlushCache(destRealPtr);
}
- Blt_Vec_UpdateClients(destRealPtr);
+ Vec_UpdateClients(destRealPtr);
if (destImagPtr->flush) {
- Blt_Vec_FlushCache(destImagPtr);
+ Vec_FlushCache(destImagPtr);
}
- Blt_Vec_UpdateClients(destImagPtr);
+ Vec_UpdateClients(destImagPtr);
return TCL_OK;
}
-
-/*
- *---------------------------------------------------------------------------
- *
- * IndexOp --
- *
- * Sets or reads the value of the index. This simulates what the
- * vector's variable does.
- *
- * Results:
- * A standard TCL result. If the index is invalid,
- * interp->result will an error message and TCL_ERROR is returned.
- * Otherwise interp->result will contain the values.
- *
- *---------------------------------------------------------------------------
- */
-static int
-IndexOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int IndexOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
int first, last;
char *string;
string = Tcl_GetString(objv[2]);
- if (Blt_Vec_GetIndexRange(interp, vPtr, string, INDEX_ALL_FLAGS,
+ if (Vec_GetIndexRange(interp, vPtr, string, INDEX_ALL_FLAGS,
(Blt_VectorIndexProc **) NULL) != TCL_OK) {
return TCL_ERROR;
}
@@ -669,7 +534,7 @@ IndexOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
return TCL_ERROR;
}
if (first == vPtr->length) {
- if (Blt_Vec_ChangeLength(interp, vPtr, vPtr->length + 1)
+ if (Vec_ChangeLength(interp, vPtr, vPtr->length + 1)
!= TCL_OK) {
return TCL_ERROR;
}
@@ -677,30 +542,15 @@ IndexOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
ReplicateValue(vPtr, first, last, value);
Tcl_SetObjResult(interp, objv[3]);
if (vPtr->flush) {
- Blt_Vec_FlushCache(vPtr);
+ Vec_FlushCache(vPtr);
}
- Blt_Vec_UpdateClients(vPtr);
+ Vec_UpdateClients(vPtr);
}
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * LengthOp --
- *
- * Returns the length of the vector. If a new size is given, the
- * vector is resized to the new vector.
- *
- * Results:
- * A standard TCL result. If the new length is invalid,
- * interp->result will an error message and TCL_ERROR is returned.
- * Otherwise interp->result will contain the length of the vector.
- *
- *---------------------------------------------------------------------------
- */
-static int
-LengthOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int LengthOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
if (objc == 3) {
int nElem;
@@ -713,40 +563,24 @@ LengthOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
Tcl_GetString(objv[2]), "\"", (char *)NULL);
return TCL_ERROR;
}
- if ((Blt_Vec_SetSize(interp, vPtr, nElem) != TCL_OK) ||
- (Blt_Vec_SetLength(interp, vPtr, nElem) != TCL_OK)) {
+ if ((Vec_SetSize(interp, vPtr, nElem) != TCL_OK) ||
+ (Vec_SetLength(interp, vPtr, nElem) != TCL_OK)) {
return TCL_ERROR;
}
if (vPtr->flush) {
- Blt_Vec_FlushCache(vPtr);
+ Vec_FlushCache(vPtr);
}
- Blt_Vec_UpdateClients(vPtr);
+ Vec_UpdateClients(vPtr);
}
Tcl_SetIntObj(Tcl_GetObjResult(interp), vPtr->length);
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * MapOp --
- *
- * Queries or sets the offset of the array index from the base
- * address of the data array of values.
- *
- * Results:
- * A standard TCL result. If the source vector doesn't exist
- * or the source list is not a valid list of numbers, TCL_ERROR
- * returned. Otherwise TCL_OK is returned.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-MapOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int MapOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
if (objc > 2) {
- if (Blt_Vec_MapVariable(interp, vPtr, Tcl_GetString(objv[2]))
+ if (Vec_MapVariable(interp, vPtr, Tcl_GetString(objv[2]))
!= TCL_OK) {
return TCL_ERROR;
}
@@ -757,43 +591,15 @@ MapOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * MaxOp --
- *
- * Returns the maximum value of the vector.
- *
- * Results:
- * A standard TCL result.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-MaxOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int MaxOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
- Tcl_SetDoubleObj(Tcl_GetObjResult(interp), Blt_Vec_Max(vPtr));
+ Tcl_SetDoubleObj(Tcl_GetObjResult(interp), Vec_Max(vPtr));
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * MergeOp --
- *
- * Merges the values from the given vectors to the current vector.
- *
- * Results:
- * A standard TCL result. If any of the given vectors differ in size,
- * TCL_ERROR is returned. Otherwise TCL_OK is returned and the
- * vector data will contain merged values of the given vectors.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-MergeOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int MergeOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
Vector **vecArr;
int refSize, nElem;
@@ -812,7 +618,7 @@ MergeOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
Vector *v2Ptr;
int length;
- if (Blt_Vec_LookupName(vPtr->dataPtr, Tcl_GetString(objv[i]), &v2Ptr)
+ if (Vec_LookupName(vPtr->dataPtr, Tcl_GetString(objv[i]), &v2Ptr)
!= TCL_OK) {
free(vecArr);
return TCL_ERROR;
@@ -836,7 +642,7 @@ MergeOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
valueArr = (double*)malloc(sizeof(double) * nElem);
if (valueArr == NULL) {
Tcl_AppendResult(vPtr->interp, "not enough memory to allocate ",
- Blt_Itoa(nElem), " vector elements", (char *)NULL);
+ Itoa(nElem), " vector elements", (char *)NULL);
return TCL_ERROR;
}
@@ -850,51 +656,24 @@ MergeOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
}
}
free(vecArr);
- Blt_Vec_Reset(vPtr, valueArr, nElem, nElem, TCL_DYNAMIC);
+ Vec_Reset(vPtr, valueArr, nElem, nElem, TCL_DYNAMIC);
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * MinOp --
- *
- * Returns the minimum value of the vector.
- *
- * Results:
- * A standard TCL result.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-MinOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int MinOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
- Tcl_SetDoubleObj(Tcl_GetObjResult(interp), Blt_Vec_Min(vPtr));
+ Tcl_SetDoubleObj(Tcl_GetObjResult(interp), Vec_Min(vPtr));
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * NormalizeOp --
- *
- * Normalizes the vector.
- *
- * Results:
- * A standard TCL result. If the density is invalid, TCL_ERROR
- * is returned. Otherwise TCL_OK is returned.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-NormalizeOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int NormalizeOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
int i;
double range;
- Blt_Vec_UpdateRange(vPtr);
+ Vec_UpdateRange(vPtr);
range = vPtr->max - vPtr->min;
if (objc > 2) {
Vector *v2Ptr;
@@ -902,22 +681,22 @@ NormalizeOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
char *string;
string = Tcl_GetString(objv[2]);
- v2Ptr = Blt_Vec_Create(vPtr->dataPtr, string, string, string, &isNew);
+ v2Ptr = Vec_Create(vPtr->dataPtr, string, string, string, &isNew);
if (v2Ptr == NULL) {
return TCL_ERROR;
}
- if (Blt_Vec_SetLength(interp, v2Ptr, vPtr->length) != TCL_OK) {
+ if (Vec_SetLength(interp, v2Ptr, vPtr->length) != TCL_OK) {
return TCL_ERROR;
}
for (i = 0; i < vPtr->length; i++) {
v2Ptr->valueArr[i] = (vPtr->valueArr[i] - vPtr->min) / range;
}
- Blt_Vec_UpdateRange(v2Ptr);
+ Vec_UpdateRange(v2Ptr);
if (!isNew) {
if (v2Ptr->flush) {
- Blt_Vec_FlushCache(v2Ptr);
+ Vec_FlushCache(v2Ptr);
}
- Blt_Vec_UpdateClients(v2Ptr);
+ Vec_UpdateClients(v2Ptr);
}
} else {
Tcl_Obj *listObjPtr;
@@ -935,29 +714,8 @@ NormalizeOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * NotifyOp --
- *
- * Notify clients of vector.
- *
- * Results:
- * A standard TCL result. If any of the given vectors differ in size,
- * TCL_ERROR is returned. Otherwise TCL_OK is returned and the
- * vector data will contain merged values of the given vectors.
- *
- * x vector notify now
- * x vector notify always
- * x vector notify whenidle
- * x vector notify update {}
- * x vector notify delete {}
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-NotifyOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int NotifyOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
int option;
int boll;
@@ -1004,22 +762,8 @@ NotifyOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * PopulateOp --
- *
- * Creates or resizes a new vector based upon the density specified.
- *
- * Results:
- * A standard TCL result. If the density is invalid, TCL_ERROR
- * is returned. Otherwise TCL_OK is returned.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-PopulateOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int PopulateOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
Vector *v2Ptr;
int size, density;
@@ -1030,7 +774,7 @@ PopulateOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
char *string;
string = Tcl_GetString(objv[2]);
- v2Ptr = Blt_Vec_Create(vPtr->dataPtr, string, string, string, &isNew);
+ v2Ptr = Vec_Create(vPtr->dataPtr, string, string, string, &isNew);
if (v2Ptr == NULL) {
return TCL_ERROR;
}
@@ -1046,7 +790,7 @@ PopulateOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
return TCL_ERROR;
}
size = (vPtr->length - 1) * (density + 1) + 1;
- if (Blt_Vec_SetLength(interp, v2Ptr, size) != TCL_OK) {
+ if (Vec_SetLength(interp, v2Ptr, size) != TCL_OK) {
return TCL_ERROR;
}
count = 0;
@@ -1066,28 +810,14 @@ PopulateOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
*valuePtr = vPtr->valueArr[i];
if (!isNew) {
if (v2Ptr->flush) {
- Blt_Vec_FlushCache(v2Ptr);
+ Vec_FlushCache(v2Ptr);
}
- Blt_Vec_UpdateClients(v2Ptr);
+ Vec_UpdateClients(v2Ptr);
}
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * ValuesOp --
- *
- * Print the values vector.
- *
- * Results:
- * A standard TCL result.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-ValuesOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int ValuesOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
{
PrintSwitches switches;
@@ -1095,7 +825,7 @@ ValuesOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
switches.from = 0;
switches.to = vPtr->length - 1;
indexSwitch.clientData = vPtr;
- if (Blt_ParseSwitches(interp, printSwitches, objc - 2, objv + 2, &switches,
+ if (ParseSwitches(interp, printSwitches, objc - 2, objv + 2, &switches,
BLT_SWITCH_DEFAULTS) < 0) {
return TCL_ERROR;
}
@@ -1134,23 +864,8 @@ ValuesOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * RangeOp --
- *
- * Returns a TCL list of the range of vector values specified.
- *
- * Results:
- * A standard TCL result. If the given range is invalid, TCL_ERROR
- * is returned. Otherwise TCL_OK is returned and interp->result
- * will contain the list of values.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-RangeOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int RangeOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
Tcl_Obj *listObjPtr;
int first, last;
@@ -1160,9 +875,9 @@ RangeOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
first = 0;
last = vPtr->length - 1;
} else if (objc == 4) {
- if ((Blt_Vec_GetIndex(interp, vPtr, Tcl_GetString(objv[2]), &first,
+ if ((Vec_GetIndex(interp, vPtr, Tcl_GetString(objv[2]), &first,
INDEX_CHECK, (Blt_VectorIndexProc **) NULL) != TCL_OK) ||
- (Blt_Vec_GetIndex(interp, vPtr, Tcl_GetString(objv[3]), &last,
+ (Vec_GetIndex(interp, vPtr, Tcl_GetString(objv[3]), &last,
INDEX_CHECK, (Blt_VectorIndexProc **) NULL) != TCL_OK)) {
return TCL_ERROR;
}
@@ -1188,28 +903,7 @@ RangeOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * InRange --
- *
- * Determines if a value lies within a given range.
- *
- * The value is normalized and compared against the interval
- * [0..1], where 0.0 is the minimum and 1.0 is the maximum.
- * DBL_EPSILON is the smallest number that can be represented
- * on the host machine, such that (1.0 + epsilon) != 1.0.
- *
- * Please note, min cannot be greater than max.
- *
- * Results:
- * If the value is within of the interval [min..max], 1 is
- * returned; 0 otherwise.
- *
- *---------------------------------------------------------------------------
- */
-INLINE static int
-InRange(double value, double min, double max)
+static int InRange(double value, double min, double max)
{
double range;
@@ -1250,8 +944,8 @@ enum NativeFormats {
*
*---------------------------------------------------------------------------
*/
-static enum NativeFormats
-GetBinaryFormat(Tcl_Interp* interp, char *string, int *sizePtr)
+static enum NativeFormats GetBinaryFormat(Tcl_Interp* interp, char *string,
+ int *sizePtr)
{
char c;
@@ -1305,9 +999,8 @@ GetBinaryFormat(Tcl_Interp* interp, char *string, int *sizePtr)
return FMT_UNKNOWN;
}
-static int
-CopyValues(Vector *vPtr, char *byteArr, enum NativeFormats fmt, int size,
- int length, int swap, int *indexPtr)
+static int CopyValues(Vector *vPtr, char *byteArr, enum NativeFormats fmt,
+ int size, int length, int swap, int *indexPtr)
{
int i, n;
int newSize;
@@ -1329,7 +1022,7 @@ CopyValues(Vector *vPtr, char *byteArr, enum NativeFormats fmt, int size,
}
newSize = *indexPtr + length;
if (newSize > vPtr->length) {
- if (Blt_Vec_ChangeLength(vPtr->interp, vPtr, newSize) != TCL_OK) {
+ if (Vec_ChangeLength(vPtr->interp, vPtr, newSize) != TCL_OK) {
return TCL_ERROR;
}
}
@@ -1415,9 +1108,9 @@ CopyValues(Vector *vPtr, char *byteArr, enum NativeFormats fmt, int size,
*
*---------------------------------------------------------------------------
*/
-/*ARGSUSED*/
-static int
-BinreadOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+
+static int BinreadOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
Tcl_Channel channel;
char *byteArr;
@@ -1488,7 +1181,7 @@ BinreadOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
return TCL_ERROR;
}
string = Tcl_GetString(objv[i]);
- if (Blt_Vec_GetIndex(interp, vPtr, string, &first, 0,
+ if (Vec_GetIndex(interp, vPtr, string, &first, 0,
(Blt_VectorIndexProc **)NULL) != TCL_OK) {
return TCL_ERROR;
}
@@ -1539,33 +1232,17 @@ BinreadOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
free(byteArr);
if (vPtr->flush) {
- Blt_Vec_FlushCache(vPtr);
+ Vec_FlushCache(vPtr);
}
- Blt_Vec_UpdateClients(vPtr);
+ Vec_UpdateClients(vPtr);
/* Set the result as the number of values read. */
Tcl_SetIntObj(Tcl_GetObjResult(interp), total);
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * SearchOp --
- *
- * Searches for a value in the vector. Returns the indices of all vector
- * elements matching a particular value.
- *
- * Results:
- * Always returns TCL_OK. interp->result will contain a list of the
- * indices of array elements matching value. If no elements match,
- * interp->result will contain the empty string.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-SearchOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int SearchOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
double min, max;
int i;
@@ -1616,24 +1293,8 @@ SearchOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * OffsetOp --
- *
- * Queries or sets the offset of the array index from the base address of
- * the data array of values.
- *
- * Results:
- * A standard TCL result. If the source vector doesn't exist or the
- * source list is not a valid list of numbers, TCL_ERROR returned.
- * Otherwise TCL_OK is returned.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-OffsetOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int OffsetOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
if (objc == 3) {
int newOffset;
@@ -1647,21 +1308,8 @@ OffsetOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * RandomOp --
- *
- * Generates random values for the length of the vector.
- *
- * Results:
- * A standard TCL result.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-RandomOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int RandomOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
int i;
@@ -1669,27 +1317,14 @@ RandomOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
vPtr->valueArr[i] = drand48();
}
if (vPtr->flush) {
- Blt_Vec_FlushCache(vPtr);
+ Vec_FlushCache(vPtr);
}
- Blt_Vec_UpdateClients(vPtr);
+ Vec_UpdateClients(vPtr);
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * SeqOp --
- *
- * Generates a sequence of values in the vector.
- *
- * Results:
- * A standard TCL result.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-SeqOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int SeqOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
int n;
double start, stop;
@@ -1708,7 +1343,7 @@ SeqOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
int i;
double step;
- if (Blt_Vec_SetLength(interp, vPtr, n) != TCL_OK) {
+ if (Vec_SetLength(interp, vPtr, n) != TCL_OK) {
return TCL_ERROR;
}
step = (stop - start) / (double)(n - 1);
@@ -1716,34 +1351,15 @@ SeqOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
vPtr->valueArr[i] = start + (step * i);
}
if (vPtr->flush) {
- Blt_Vec_FlushCache(vPtr);
+ Vec_FlushCache(vPtr);
}
- Blt_Vec_UpdateClients(vPtr);
+ Vec_UpdateClients(vPtr);
}
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * SetOp --
- *
- * Sets the data of the vector object from a list of values.
- *
- * Results:
- * A standard TCL result. If the source vector doesn't exist or the
- * source list is not a valid list of numbers, TCL_ERROR returned.
- * Otherwise TCL_OK is returned.
- *
- * Side Effects:
- * The vector data is reset. Clients of the vector are notified. Any
- * cached array indices are flushed.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-SetOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int SetOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
int result;
Vector *v2Ptr;
@@ -1752,7 +1368,7 @@ SetOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
/* The source can be either a list of numbers or another vector. */
- v2Ptr = Blt_Vec_ParseElement((Tcl_Interp *)NULL, vPtr->dataPtr,
+ v2Ptr = Vec_ParseElement((Tcl_Interp *)NULL, vPtr->dataPtr,
Tcl_GetString(objv[2]), NULL, NS_SEARCH_BOTH);
if (v2Ptr != NULL) {
if (vPtr == v2Ptr) {
@@ -1761,14 +1377,14 @@ SetOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
* Source and destination vectors are the same. Copy the source
* first into a temporary vector to avoid memory overlaps.
*/
- tmpPtr = Blt_Vec_New(vPtr->dataPtr);
- result = Blt_Vec_Duplicate(tmpPtr, v2Ptr);
+ tmpPtr = Vec_New(vPtr->dataPtr);
+ result = Vec_Duplicate(tmpPtr, v2Ptr);
if (result == TCL_OK) {
- result = Blt_Vec_Duplicate(vPtr, tmpPtr);
+ result = Vec_Duplicate(vPtr, tmpPtr);
}
- Blt_Vec_Free(tmpPtr);
+ Vec_Free(tmpPtr);
} else {
- result = Blt_Vec_Duplicate(vPtr, v2Ptr);
+ result = Vec_Duplicate(vPtr, v2Ptr);
}
} else if (Tcl_ListObjGetElements(interp, objv[2], &nElem, &elemObjArr)
== TCL_OK) {
@@ -1784,34 +1400,15 @@ SetOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
* clients that it's been modified.
*/
if (vPtr->flush) {
- Blt_Vec_FlushCache(vPtr);
+ Vec_FlushCache(vPtr);
}
- Blt_Vec_UpdateClients(vPtr);
+ Vec_UpdateClients(vPtr);
}
return result;
}
-/*
- *---------------------------------------------------------------------------
- *
- * SimplifyOp --
- *
- * Sets the data of the vector object from a list of values.
- *
- * Results:
- * A standard TCL result. If the source vector doesn't exist or the
- * source list is not a valid list of numbers, TCL_ERROR returned.
- * Otherwise TCL_OK is returned.
- *
- * Side Effects:
- * The vector data is reset. Clients of the vector are notified. Any
- * cached array indices are flushed.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-SimplifyOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int SimplifyOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
size_t i, n;
int length, nPoints;
@@ -1829,41 +1426,28 @@ SimplifyOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
reduced[i] = orig[simple[i]];
}
free(simple);
- Blt_Vec_Reset(vPtr, (double *)reduced, n * 2, vPtr->length, TCL_DYNAMIC);
+ Vec_Reset(vPtr, (double *)reduced, n * 2, vPtr->length, TCL_DYNAMIC);
/*
* The vector has changed; so flush the array indices (they're wrong
* now), find the new range of the data, and notify the vector's
* clients that it's been modified.
*/
if (vPtr->flush) {
- Blt_Vec_FlushCache(vPtr);
+ Vec_FlushCache(vPtr);
}
- Blt_Vec_UpdateClients(vPtr);
+ Vec_UpdateClients(vPtr);
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * SplitOp --
- *
- * Copies the values from the vector evenly into one of more vectors.
- *
- * Results:
- * A standard TCL result.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-SplitOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int SplitOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
int nVectors;
nVectors = objc - 2;
if ((vPtr->length % nVectors) != 0) {
Tcl_AppendResult(interp, "can't split vector \"", vPtr->name,
- "\" into ", Blt_Itoa(nVectors), " even parts.", (char *)NULL);
+ "\" into ", Itoa(nVectors), " even parts.", (char *)NULL);
return TCL_ERROR;
}
if (nVectors > 0) {
@@ -1875,19 +1459,19 @@ SplitOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
extra = vPtr->length / nVectors;
for (i = 0; i < nVectors; i++) {
string = Tcl_GetString(objv[i+2]);
- v2Ptr = Blt_Vec_Create(vPtr->dataPtr, string, string, string,
+ v2Ptr = Vec_Create(vPtr->dataPtr, string, string, string,
&isNew);
oldSize = v2Ptr->length;
newSize = oldSize + extra;
- if (Blt_Vec_SetLength(interp, v2Ptr, newSize) != TCL_OK) {
+ if (Vec_SetLength(interp, v2Ptr, newSize) != TCL_OK) {
return TCL_ERROR;
}
for (j = i, k = oldSize; j < vPtr->length; j += nVectors, k++) {
v2Ptr->valueArr[k] = vPtr->valueArr[j];
}
- Blt_Vec_UpdateClients(v2Ptr);
+ Vec_UpdateClients(v2Ptr);
if (v2Ptr->flush) {
- Blt_Vec_FlushCache(v2Ptr);
+ Vec_FlushCache(v2Ptr);
}
}
}
@@ -1902,8 +1486,7 @@ static int sortDecreasing; /* Indicates the ordering of the sort. If
* non-zero, the vectors are sorted in
* decreasing order */
-static int
-CompareVectors(void *a, void *b)
+static int CompareVectors(void *a, void *b)
{
double delta;
int i;
@@ -1923,27 +1506,7 @@ CompareVectors(void *a, void *b)
return 0;
}
-/*
- *---------------------------------------------------------------------------
- *
- * Blt_Vec_SortMap --
- *
- * Returns an array of indices that represents the sorted mapping of the
- * original vector.
- *
- * Results:
- * A standard TCL result. If any of the auxiliary vectors are a
- * different size than the sorted vector object, TCL_ERROR is returned.
- * Otherwise TCL_OK is returned.
- *
- * Side Effects:
- * The vectors are sorted.
- *
- * vecName sort ?switches? vecName vecName...
- *---------------------------------------------------------------------------
- */
-size_t *
-Blt_Vec_SortMap(Vector **vectors, int nVectors)
+size_t* Blt::Vec_SortMap(Vector **vectors, int nVectors)
{
size_t *map;
int i;
@@ -1963,8 +1526,8 @@ Blt_Vec_SortMap(Vector **vectors, int nVectors)
return map;
}
-static size_t *
-SortVectors(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static size_t* SortVectors(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
Vector **vectors, *v2Ptr;
size_t *map;
@@ -1974,7 +1537,7 @@ SortVectors(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
vectors[0] = vPtr;
map = NULL;
for (i = 0; i < objc; i++) {
- if (Blt_Vec_LookupName(vPtr->dataPtr, Tcl_GetString(objv[i]),
+ if (Vec_LookupName(vPtr->dataPtr, Tcl_GetString(objv[i]),
&v2Ptr) != TCL_OK) {
goto error;
}
@@ -1986,34 +1549,13 @@ SortVectors(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
}
vectors[i + 1] = v2Ptr;
}
- map = Blt_Vec_SortMap(vectors, objc + 1);
+ map = Vec_SortMap(vectors, objc + 1);
error:
free(vectors);
return map;
}
-
-/*
- *---------------------------------------------------------------------------
- *
- * SortOp --
- *
- * Sorts the vector object and any other vectors according to sorting
- * order of the vector object.
- *
- * Results:
- * A standard TCL result. If any of the auxiliary vectors are a
- * different size than the sorted vector object, TCL_ERROR is returned.
- * Otherwise TCL_OK is returned.
- *
- * Side Effects:
- * The vectors are sorted.
- *
- * vecName sort ?switches? vecName vecName...
- *---------------------------------------------------------------------------
- */
-static int
-SortOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int SortOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
{
Vector *v2Ptr;
double *copy;
@@ -2026,7 +1568,7 @@ SortOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
sortDecreasing = 0;
switches.flags = 0;
- i = Blt_ParseSwitches(interp, sortSwitches, objc - 2, objv + 2, &switches,
+ i = ParseSwitches(interp, sortSwitches, objc - 2, objv + 2, &switches,
BLT_SWITCH_OBJV_PARTIAL);
if (i < 0) {
return TCL_ERROR;
@@ -2036,7 +1578,7 @@ SortOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
if (objc > 2) {
map = SortVectors(vPtr, interp, objc - 2, objv + 2);
} else {
- map = Blt_Vec_SortMap(&vPtr, 1);
+ map = Vec_SortMap(&vPtr, 1);
}
if (map == NULL) {
return TCL_ERROR;
@@ -2067,34 +1609,34 @@ SortOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
nBytes = sortLength * sizeof(double);
}
if (sortLength != vPtr->length) {
- Blt_Vec_SetLength(interp, vPtr, sortLength);
+ Vec_SetLength(interp, vPtr, sortLength);
}
for (n = 0; n < sortLength; n++) {
vPtr->valueArr[n] = copy[map[n]];
}
if (vPtr->flush) {
- Blt_Vec_FlushCache(vPtr);
+ Vec_FlushCache(vPtr);
}
- Blt_Vec_UpdateClients(vPtr);
+ Vec_UpdateClients(vPtr);
/* Now sort any other vectors in the same fashion. The vectors must be
* the same size as the map though. */
result = TCL_ERROR;
for (i = 2; i < objc; i++) {
- if (Blt_Vec_LookupName(vPtr->dataPtr, Tcl_GetString(objv[i]),
+ if (Vec_LookupName(vPtr->dataPtr, Tcl_GetString(objv[i]),
&v2Ptr) != TCL_OK) {
goto error;
}
if (sortLength != v2Ptr->length) {
- Blt_Vec_SetLength(interp, v2Ptr, sortLength);
+ Vec_SetLength(interp, v2Ptr, sortLength);
}
memcpy((char *)copy, (char *)v2Ptr->valueArr, nBytes);
for (n = 0; n < sortLength; n++) {
v2Ptr->valueArr[n] = copy[map[n]];
}
- Blt_Vec_UpdateClients(v2Ptr);
+ Vec_UpdateClients(v2Ptr);
if (v2Ptr->flush) {
- Blt_Vec_FlushCache(v2Ptr);
+ Vec_FlushCache(v2Ptr);
}
}
result = TCL_OK;
@@ -2104,54 +1646,23 @@ SortOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
return result;
}
-/*
- *---------------------------------------------------------------------------
- *
- * InstExprOp --
- *
- * Computes the result of the expression which may be either a scalar
- * (single value) or vector (list of values).
- *
- * Results:
- * A standard TCL result.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-InstExprOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int InstExprOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
- if (Blt_ExprVector(interp, Tcl_GetString(objv[2]), (Blt_Vector *)vPtr)
+ if (ExprVector(interp, Tcl_GetString(objv[2]), (Blt_Vector *)vPtr)
!= TCL_OK) {
return TCL_ERROR;
}
if (vPtr->flush) {
- Blt_Vec_FlushCache(vPtr);
+ Vec_FlushCache(vPtr);
}
- Blt_Vec_UpdateClients(vPtr);
+ Vec_UpdateClients(vPtr);
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * ArithOp --
- *
- * Results:
- * A standard TCL result. If the source vector doesn't exist or the
- * source list is not a valid list of numbers, TCL_ERROR returned.
- * Otherwise TCL_OK is returned.
- *
- * Side Effects:
- * The vector data is reset. Clients of the vector are notified.
- * Any cached array indices are flushed.
- *
- *---------------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static int
-ArithOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
+static int ArithOp(Vector *vPtr, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
double value;
int i;
@@ -2160,7 +1671,7 @@ ArithOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
Tcl_Obj *listObjPtr;
char *string;
- v2Ptr = Blt_Vec_ParseElement((Tcl_Interp *)NULL, vPtr->dataPtr,
+ v2Ptr = Vec_ParseElement((Tcl_Interp *)NULL, vPtr->dataPtr,
Tcl_GetString(objv[2]), NULL, NS_SEARCH_BOTH);
if (v2Ptr != NULL) {
int j;
@@ -2253,18 +1764,6 @@ ArithOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * VectorInstCmd --
- *
- * Parses and invokes the appropriate vector instance command option.
- *
- * Results:
- * A standard TCL result.
- *
- *---------------------------------------------------------------------------
- */
static Blt_OpSpec vectorInstOps[] =
{
{"*", 1, (void*)ArithOp, 3, 3, "item",}, /*Deprecated*/
@@ -2302,39 +1801,24 @@ static Blt_OpSpec vectorInstOps[] =
static int nInstOps = sizeof(vectorInstOps) / sizeof(Blt_OpSpec);
-int
-Blt_Vec_InstCmd(ClientData clientData, Tcl_Interp* interp, int objc,
- Tcl_Obj* const objv[])
+int Blt::Vec_InstCmd(ClientData clientData, Tcl_Interp* interp,
+ int objc, Tcl_Obj* const objv[])
{
VectorCmdProc* proc;
Vector* vPtr = (Vector*)clientData;
vPtr->first = 0;
vPtr->last = vPtr->length - 1;
- proc = (VectorCmdProc*)Blt_GetOpFromObj(interp, nInstOps, vectorInstOps, BLT_OP_ARG1, objc,
- objv, 0);
+ proc = (VectorCmdProc*)GetOpFromObj(interp, nInstOps, vectorInstOps,
+ BLT_OP_ARG1, objc, objv, 0);
if (proc == NULL) {
return TCL_ERROR;
}
return (*proc) (vPtr, interp, objc, objv);
}
-
-/*
- *---------------------------------------------------------------------------
- *
- * Blt_Vec_VarTrace --
- *
- * Results:
- * Returns NULL on success. Only called from a variable trace.
- *
- * Side effects:
- *
- *---------------------------------------------------------------------------
- */
-char *
-Blt_Vec_VarTrace(ClientData clientData, Tcl_Interp* interp, const char *part1,
- const char *part2, int flags)
+char* Blt::Vec_VarTrace(ClientData clientData, Tcl_Interp* interp,
+ const char *part1, const char *part2, int flags)
{
Blt_VectorIndexProc *indexProc;
Vector* vPtr = (Vector*)clientData;
@@ -2348,12 +1832,12 @@ Blt_Vec_VarTrace(ClientData clientData, Tcl_Interp* interp, const char *part1,
free((void*)(vPtr->arrayName));
vPtr->arrayName = NULL;
if (vPtr->freeOnUnset) {
- Blt_Vec_Free(vPtr);
+ Vec_Free(vPtr);
}
}
return NULL;
}
- if (Blt_Vec_GetIndexRange(interp, vPtr, part2, INDEX_ALL_FLAGS, &indexProc)
+ if (Vec_GetIndexRange(interp, vPtr, part2, INDEX_ALL_FLAGS, &indexProc)
!= TCL_OK) {
goto error;
}
@@ -2379,7 +1863,7 @@ Blt_Vec_VarTrace(ClientData clientData, Tcl_Interp* interp, const char *part1,
goto error;
}
if (first == vPtr->length) {
- if (Blt_Vec_ChangeLength((Tcl_Interp *)NULL, vPtr, vPtr->length + 1)
+ if (Vec_ChangeLength((Tcl_Interp *)NULL, vPtr, vPtr->length + 1)
!= TCL_OK) {
return (char *)"error resizing vector";
}
@@ -2434,13 +1918,13 @@ Blt_Vec_VarTrace(ClientData clientData, Tcl_Interp* interp, const char *part1,
}
vPtr->length -= ((last - first) + 1);
if (vPtr->flush) {
- Blt_Vec_FlushCache(vPtr);
+ Vec_FlushCache(vPtr);
}
} else {
return (char *)"unknown variable trace flag";
}
if (flags & (TCL_TRACE_UNSETS | TCL_TRACE_WRITES)) {
- Blt_Vec_UpdateClients(vPtr);
+ Vec_UpdateClients(vPtr);
}
Tcl_ResetResult(interp);
return NULL;
diff --git a/src/bltVecInt.h b/src/bltVecInt.h
index da2e107..c09cf10 100644
--- a/src/bltVecInt.h
+++ b/src/bltVecInt.h
@@ -50,103 +50,6 @@
#define FFT_BARTLETT (1<<1)
#define FFT_SPECTRUM (1<<2)
-typedef struct {
- double x;
- double y;
-} Point2d;
-
-typedef struct {
- Tcl_HashTable vectorTable; /* Table of vectors */
- Tcl_HashTable mathProcTable; /* Table of vector math functions */
- Tcl_HashTable indexProcTable;
- Tcl_Interp* interp;
- unsigned int nextId;
-} VectorInterpData;
-
-/*
- * Vector --
- *
- * A vector is an array of double precision values. It can be accessed
- * through a TCL command, a TCL array variable, or C API. The storage for
- * the array points initially to a statically allocated buffer, but to
- * malloc-ed memory if more is necessary.
- *
- * Vectors can be shared by several clients (for example, two different
- * graph widgets). The data is shared. When a client wants to use a
- * vector, it allocates a vector identifier, which identifies the client.
- * Clients use this ID to specify a callback routine to be invoked
- * whenever the vector is modified or destroyed. Whenever the vector is
- * updated or destroyed, each client is notified of the change by their
- * callback routine.
- */
-
-typedef struct {
-
- /*
- * If you change these fields, make sure you change the definition of
- * Blt_Vector in blt.h too.
- */
-
- double *valueArr; /* Array of values (malloc-ed) */
-
- int length; /* Current number of values in the array. */
-
- int size; /* Maximum number of values that can be stored
- * in the value array. */
-
- double min, max; /* Minimum and maximum values in the vector */
-
- int dirty; /* Indicates if the vector has been updated */
-
- int reserved;
-
- /* The following fields are local to this module */
-
- const char *name; /* The namespace-qualified name of the vector.
- * It points to the hash key allocated for the
- * entry in the vector hash table. */
-
- VectorInterpData *dataPtr;
- Tcl_Interp* interp; /* Interpreter associated with the
- * vector */
-
- Tcl_HashEntry *hashPtr; /* If non-NULL, pointer in a hash table to
- * track the vectors in use. */
-
- Tcl_FreeProc *freeProc; /* Address of procedure to call to release
- * storage for the value array, Optionally can
- * be one of the following: TCL_STATIC,
- * TCL_DYNAMIC, or TCL_VOLATILE. */
-
- const char *arrayName; /* The name of the TCL array variable mapped
- * to the vector (malloc'ed). If NULL,
- * indicates that the vector isn't mapped to
- * any variable */
-
- Tcl_Namespace *nsPtr; /* Namespace context of the vector itself. */
-
- int offset; /* Offset from zero of the vector's starting
- * index */
-
- Tcl_Command cmdToken; /* Token for vector's TCL command. */
-
- Blt_Chain chain; /* List of clients using this vector */
-
- int notifyFlags; /* Notification flags. See definitions
- * below */
-
- int varFlags; /* Indicate if the variable is global,
- * namespace, or local */
-
- int freeOnUnset; /* For backward compatibility only: If
- * non-zero, free the vector when its variable
- * is unset. */
- int flush;
-
- int first, last; /* Selected region of vector. This is used
- * mostly for the math routines */
-} Vector;
-
#define NOTIFY_UPDATED ((int)BLT_VECTOR_NOTIFY_UPDATE)
#define NOTIFY_DESTROYED ((int)BLT_VECTOR_NOTIFY_DESTROY)
@@ -184,76 +87,129 @@ typedef struct {
} \
}
- extern const char *Blt_Itoa(int value);
-
-extern void Blt_Vec_InstallSpecialIndices(Tcl_HashTable *tablePtr);
-
-extern void Blt_Vec_InstallMathFunctions(Tcl_HashTable *tablePtr);
-
-extern void Blt_Vec_UninstallMathFunctions(Tcl_HashTable *tablePtr);
-
-extern VectorInterpData *Blt_Vec_GetInterpData (Tcl_Interp* interp);
+namespace Blt {
-extern double Blt_Vec_Max(Vector *vecObjPtr);
-extern double Blt_Vec_Min(Vector *vecObjPtr);
+ typedef struct {
+ double x;
+ double y;
+ } Point2d;
-extern Vector *Blt_Vec_New(VectorInterpData *dataPtr);
+ typedef struct {
+ Tcl_HashTable vectorTable; /* Table of vectors */
+ Tcl_HashTable mathProcTable; /* Table of vector math functions */
+ Tcl_HashTable indexProcTable;
+ Tcl_Interp* interp;
+ unsigned int nextId;
+ } VectorInterpData;
-extern int Blt_Vec_Duplicate(Vector *destPtr, Vector *srcPtr);
+ typedef struct {
+ // If you change these fields, make sure you change the definition of
+ // Blt_Vector in blt.h too.
+ double *valueArr; /* Array of values (malloc-ed) */
-extern int Blt_Vec_SetLength(Tcl_Interp* interp, Vector *vPtr,
- int length);
+ int length; /* Current number of values in the array. */
-extern int Blt_Vec_SetSize(Tcl_Interp* interp, Vector *vPtr,
- int size);
+ int size; /* Maximum number of values that can be stored
+ * in the value array. */
-extern int Blt_Vec_ChangeLength(Tcl_Interp* interp, Vector *vPtr,
- int length);
+ double min, max; /* Minimum and maximum values in the vector */
-extern Vector *Blt_Vec_ParseElement(Tcl_Interp* interp,
- VectorInterpData *dataPtr, const char *start, const char **endPtr,
- int flags);
+ int dirty; /* Indicates if the vector has been updated */
-extern void Blt_Vec_Free(Vector *vPtr);
+ int reserved;
-extern size_t *Blt_Vec_SortMap(Vector **vectors, int nVectors);
+ /* The following fields are local to this module */
-extern int Blt_Vec_LookupName(VectorInterpData *dataPtr,
- const char *vecName, Vector **vPtrPtr);
+ const char *name; /* The namespace-qualified name of the vector.
+ * It points to the hash key allocated for the
+ * entry in the vector hash table. */
-extern Vector *Blt_Vec_Create(VectorInterpData *dataPtr,
- const char *name, const char *cmdName, const char *varName,
- int *newPtr);
+ VectorInterpData *dataPtr;
+ Tcl_Interp* interp; /* Interpreter associated with the
+ * vector */
-extern void Blt_Vec_UpdateRange(Vector *vPtr);
+ Tcl_HashEntry *hashPtr; /* If non-NULL, pointer in a hash table to
+ * track the vectors in use. */
-extern void Blt_Vec_UpdateClients(Vector *vPtr);
+ Tcl_FreeProc *freeProc; /* Address of procedure to call to release
+ * storage for the value array, Optionally can
+ * be one of the following: TCL_STATIC,
+ * TCL_DYNAMIC, or TCL_VOLATILE. */
-extern void Blt_Vec_FlushCache(Vector *vPtr);
+ const char *arrayName; /* The name of the TCL array variable mapped
+ * to the vector (malloc'ed). If NULL,
+ * indicates that the vector isn't mapped to
+ * any variable */
-extern int Blt_Vec_Reset(Vector *vPtr, double *dataArr,
- int nValues, int arraySize, Tcl_FreeProc *freeProc);
+ Tcl_Namespace *nsPtr; /* Namespace context of the vector itself. */
-extern int Blt_Vec_GetIndex(Tcl_Interp* interp, Vector *vPtr,
- const char *string, int *indexPtr, int flags,
- Blt_VectorIndexProc **procPtrPtr);
+ int offset; /* Offset from zero of the vector's starting
+ * index */
-extern int Blt_Vec_GetIndexRange(Tcl_Interp* interp, Vector *vPtr,
- const char *string, int flags, Blt_VectorIndexProc **procPtrPtr);
+ Tcl_Command cmdToken; /* Token for vector's TCL command. */
-extern int Blt_Vec_MapVariable(Tcl_Interp* interp, Vector *vPtr,
- const char *name);
+ Blt_Chain chain; /* List of clients using this vector */
-extern int Blt_Vec_FFT(Tcl_Interp* interp, Vector *realPtr,
- Vector *phasesPtr, Vector *freqPtr, double delta,
- int flags, Vector *srcPtr);
+ int notifyFlags; /* Notification flags. See definitions
+ * below */
-extern int Blt_Vec_InverseFFT(Tcl_Interp* interp, Vector *iSrcPtr,
- Vector *rDestPtr, Vector *iDestPtr, Vector *srcPtr);
+ int varFlags; /* Indicate if the variable is global,
+ * namespace, or local */
-extern Tcl_ObjCmdProc Blt_Vec_InstCmd;
+ int freeOnUnset; /* For backward compatibility only: If
+ * non-zero, free the vector when its variable
+ * is unset. */
+ int flush;
-extern Tcl_VarTraceProc Blt_Vec_VarTrace;
+ int first, last; /* Selected region of vector. This is used
+ * mostly for the math routines */
+ } Vector;
+
+ extern const char* Itoa(int value);
+ extern int Vec_GetIndex(Tcl_Interp* interp, Vector *vPtr,
+ const char *string, int *indexPtr, int flags,
+ Blt_VectorIndexProc **procPtrPtr);
+ extern int Vec_GetIndexRange(Tcl_Interp* interp, Vector *vPtr,
+ const char *string, int flags,
+ Blt_VectorIndexProc **procPtrPtr);
+ extern Vector* Vec_ParseElement(Tcl_Interp* interp, VectorInterpData *dataPtr,
+ const char *start, const char **endPtr,
+ int flags);
+ extern int Vec_SetLength(Tcl_Interp* interp, Vector *vPtr, int length);
+ extern int Vec_SetSize(Tcl_Interp* interp, Vector *vPtr, int size);
+ extern void Vec_FlushCache(Vector *vPtr);
+ extern void Vec_UpdateRange(Vector *vPtr);
+ extern void Vec_UpdateClients(Vector *vPtr);
+ extern void Vec_Free(Vector *vPtr);
+ extern Vector* Vec_New(VectorInterpData *dataPtr);
+ extern int Vec_MapVariable(Tcl_Interp* interp, Vector *vPtr,
+ const char *name);
+ extern int Vec_ChangeLength(Tcl_Interp* interp, Vector *vPtr, int length);
+ extern Vector* Vec_Create(VectorInterpData *dataPtr, const char *name,
+ const char *cmdName, const char *varName,
+ int *newPtr);
+ extern int Vec_LookupName(VectorInterpData *dataPtr, const char *vecName,
+ Vector **vPtrPtr);
+ extern VectorInterpData* Vec_GetInterpData (Tcl_Interp* interp);
+ extern int Vec_Reset(Vector *vPtr, double *dataArr, int nValues,
+ int arraySize, Tcl_FreeProc *freeProc);
+ extern int Vec_FFT(Tcl_Interp* interp, Vector *realPtr,
+ Vector *phasesPtr, Vector *freqPtr, double delta,
+ int flags, Vector *srcPtr);
+ extern int Vec_InverseFFT(Tcl_Interp* interp, Vector *iSrcPtr,
+ Vector *rDestPtr, Vector *iDestPtr,
+ Vector *srcPtr);
+ extern int Vec_Duplicate(Vector *destPtr, Vector *srcPtr);
+ extern size_t *Vec_SortMap(Vector **vectors, int nVectors);
+ extern double Vec_Max(Vector *vecObjPtr);
+ extern double Vec_Min(Vector *vecObjPtr);
+
+ extern Tcl_ObjCmdProc Vec_InstCmd;
+ extern Tcl_VarTraceProc Vec_VarTrace;
+ extern void Vec_InstallMathFunctions(Tcl_HashTable *tablePtr);
+ extern void Vec_UninstallMathFunctions(Tcl_HashTable *tablePtr);
+ extern void Vec_InstallSpecialIndices(Tcl_HashTable *tablePtr);
+};
extern Tcl_IdleProc Blt_Vec_NotifyClients;
diff --git a/src/bltVecMath.C b/src/bltVecMath.C
index 90b527e..d978a26 100644
--- a/src/bltVecMath.C
+++ b/src/bltVecMath.C
@@ -40,6 +40,8 @@
#include "bltNsUtil.h"
#include "bltParse.h"
+using namespace Blt;
+
/*
* Three types of math functions:
*
@@ -169,7 +171,7 @@ static int Sort(Vector *vPtr)
double *values;
int i;
- map = Blt_Vec_SortMap(&vPtr, 1);
+ map = Vec_SortMap(&vPtr, 1);
values = (double*)malloc(sizeof(double) * vPtr->length);
for(i = vPtr->first; i <= vPtr->last; i++) {
values[i] = vPtr->valueArr[map[i]];
@@ -191,13 +193,13 @@ static double Length(Blt_Vector *vectorPtr)
double Blt_VecMax(Blt_Vector *vectorPtr)
{
Vector *vPtr = (Vector *)vectorPtr;
- return Blt_Vec_Max(vPtr);
+ return Vec_Max(vPtr);
}
double Blt_VecMin(Blt_Vector *vectorPtr)
{
Vector *vPtr = (Vector *)vectorPtr;
- return Blt_Vec_Min(vPtr);
+ return Vec_Min(vPtr);
}
static double Product(Blt_Vector *vectorPtr)
@@ -378,7 +380,7 @@ static double Median(Blt_Vector *vectorPtr)
if (vPtr->length == 0) {
return -DBL_MAX;
}
- map = Blt_Vec_SortMap(&vPtr, 1);
+ map = Vec_SortMap(&vPtr, 1);
mid = (vPtr->length - 1) / 2;
/*
@@ -405,7 +407,7 @@ static double Q1(Blt_Vector *vectorPtr)
if (vPtr->length == 0) {
return -DBL_MAX;
}
- map = Blt_Vec_SortMap(&vPtr, 1);
+ map = Vec_SortMap(&vPtr, 1);
if (vPtr->length < 4) {
q1 = vPtr->valueArr[map[0]];
@@ -441,7 +443,7 @@ static double Q3(Blt_Vector *vectorPtr)
return -DBL_MAX;
}
- map = Blt_Vec_SortMap(&vPtr, 1);
+ map = Vec_SortMap(&vPtr, 1);
if (vPtr->length < 4) {
q3 = vPtr->valueArr[map[vPtr->length - 1]];
@@ -473,8 +475,8 @@ static int Norm(Blt_Vector *vector)
double norm, range, min, max;
int i;
- min = Blt_Vec_Min(vPtr);
- max = Blt_Vec_Max(vPtr);
+ min = Vec_Min(vPtr);
+ max = Vec_Max(vPtr);
range = max - min;
for (i = 0; i < vPtr->length; i++) {
norm = (vPtr->valueArr[i] - min) / range;
@@ -562,7 +564,7 @@ static void MathError(Tcl_Interp* interp, double value)
}
else {
Tcl_AppendResult(interp, "unknown floating-point error, ",
- "errno = ", Blt_Itoa(errno), (char *)NULL);
+ "errno = ", Itoa(errno), (char *)NULL);
Tcl_SetErrorCode(interp, "ARITH", "UNKNOWN",
Tcl_GetStringResult(interp), (char *)NULL);
}
@@ -589,7 +591,7 @@ static int ParseString(Tcl_Interp* interp, const char *string, Value *valuePtr)
return TCL_ERROR;
}
/* Numbers are stored as single element vectors. */
- if (Blt_Vec_ChangeLength(interp, valuePtr->vPtr, 1) != TCL_OK) {
+ if (Vec_ChangeLength(interp, valuePtr->vPtr, 1) != TCL_OK) {
return TCL_ERROR;
}
valuePtr->vPtr->valueArr[0] = value;
@@ -600,7 +602,7 @@ static int ParseString(Tcl_Interp* interp, const char *string, Value *valuePtr)
while (isspace((unsigned char)(*string))) {
string++; /* Skip spaces leading the vector name. */
}
- vPtr = Blt_Vec_ParseElement(interp, valuePtr->vPtr->dataPtr,
+ vPtr = Vec_ParseElement(interp, valuePtr->vPtr->dataPtr,
string, &endPtr, NS_SEARCH_BOTH);
if (vPtr == NULL) {
return TCL_ERROR;
@@ -611,7 +613,7 @@ static int ParseString(Tcl_Interp* interp, const char *string, Value *valuePtr)
return TCL_ERROR;
}
/* Copy the designated vector to our temporary. */
- Blt_Vec_Duplicate(valuePtr->vPtr, vPtr);
+ Vec_Duplicate(valuePtr->vPtr, vPtr);
}
return TCL_OK;
}
@@ -707,7 +709,7 @@ static int NextToken(Tcl_Interp* interp, ParseInfo *piPtr, Value *valuePtr)
/*
* Save the single floating-point value as an 1-component vector.
*/
- if (Blt_Vec_ChangeLength(interp, valuePtr->vPtr, 1) != TCL_OK) {
+ if (Vec_ChangeLength(interp, valuePtr->vPtr, 1) != TCL_OK) {
return TCL_ERROR;
}
valuePtr->vPtr->valueArr[0] = value;
@@ -729,7 +731,7 @@ static int NextToken(Tcl_Interp* interp, ParseInfo *piPtr, Value *valuePtr)
case '[':
piPtr->token = VALUE;
- result = Blt_ParseNestedCmd(interp, p + 1, 0, &endPtr, &valuePtr->pv);
+ result = ParseNestedCmd(interp, p + 1, 0, &endPtr, &valuePtr->pv);
if (result != TCL_OK) {
return result;
}
@@ -740,7 +742,7 @@ static int NextToken(Tcl_Interp* interp, ParseInfo *piPtr, Value *valuePtr)
case '"':
piPtr->token = VALUE;
- result = Blt_ParseQuotes(interp, p + 1, '"', 0, &endPtr, &valuePtr->pv);
+ result = ParseQuotes(interp, p + 1, '"', 0, &endPtr, &valuePtr->pv);
if (result != TCL_OK) {
return result;
}
@@ -751,7 +753,7 @@ static int NextToken(Tcl_Interp* interp, ParseInfo *piPtr, Value *valuePtr)
case '{':
piPtr->token = VALUE;
- result = Blt_ParseBraces(interp, p + 1, &endPtr, &valuePtr->pv);
+ result = ParseBraces(interp, p + 1, &endPtr, &valuePtr->pv);
if (result != TCL_OK) {
return result;
}
@@ -875,12 +877,12 @@ static int NextToken(Tcl_Interp* interp, ParseInfo *piPtr, Value *valuePtr)
while (isspace((unsigned char)(*p))) {
p++; /* Skip spaces leading the vector name. */
}
- vPtr = Blt_Vec_ParseElement(interp, valuePtr->vPtr->dataPtr,
+ vPtr = Vec_ParseElement(interp, valuePtr->vPtr->dataPtr,
p, &endPtr, NS_SEARCH_BOTH);
if (vPtr == NULL) {
return TCL_ERROR;
}
- Blt_Vec_Duplicate(valuePtr->vPtr, vPtr);
+ Vec_Duplicate(valuePtr->vPtr, vPtr);
piPtr->nextPtr = endPtr;
}
}
@@ -905,12 +907,12 @@ static int NextValue(Tcl_Interp* interp, ParseInfo *piPtr,
*/
vPtr = valuePtr->vPtr;
- v2Ptr = Blt_Vec_New(vPtr->dataPtr);
+ v2Ptr = Vec_New(vPtr->dataPtr);
gotOp = 0;
value2.vPtr = v2Ptr;
value2.pv.buffer = value2.pv.next = value2.staticSpace;
value2.pv.end = value2.pv.buffer + STATIC_STRING_SPACE - 1;
- value2.pv.expandProc = Blt_ExpandParseValue;
+ value2.pv.expandProc = ExpandParseValue;
value2.pv.clientData = NULL;
result = NextToken(interp, piPtr, valuePtr);
@@ -1169,7 +1171,7 @@ static int NextValue(Tcl_Interp* interp, ParseInfo *piPtr,
* 1st operand is a scalar.
*/
scalar = vPtr->valueArr[0];
- Blt_Vec_Duplicate(vPtr, v2Ptr);
+ Vec_Duplicate(vPtr, v2Ptr);
opnd = vPtr->valueArr;
switch (oper) {
case MULT:
@@ -1391,14 +1393,14 @@ static int NextValue(Tcl_Interp* interp, ParseInfo *piPtr,
if (value2.pv.buffer != value2.staticSpace) {
free(value2.pv.buffer);
}
- Blt_Vec_Free(v2Ptr);
+ Vec_Free(v2Ptr);
return result;
error:
if (value2.pv.buffer != value2.staticSpace) {
free(value2.pv.buffer);
}
- Blt_Vec_Free(v2Ptr);
+ Vec_Free(v2Ptr);
return TCL_ERROR;
}
@@ -1413,7 +1415,7 @@ static int EvaluateExpression(Tcl_Interp* interp, char *string,
info.expr = info.nextPtr = string;
valuePtr->pv.buffer = valuePtr->pv.next = valuePtr->staticSpace;
valuePtr->pv.end = valuePtr->pv.buffer + STATIC_STRING_SPACE - 1;
- valuePtr->pv.expandProc = Blt_ExpandParseValue;
+ valuePtr->pv.expandProc = ExpandParseValue;
valuePtr->pv.clientData = NULL;
result = NextValue(interp, &info, -1, valuePtr);
@@ -1476,7 +1478,7 @@ static int ScalarFunc(ClientData clientData, Tcl_Interp* interp, Vector *vPtr)
MathError(interp, value);
return TCL_ERROR;
}
- if (Blt_Vec_ChangeLength(interp, vPtr, 1) != TCL_OK) {
+ if (Vec_ChangeLength(interp, vPtr, 1) != TCL_OK) {
return TCL_ERROR;
}
vPtr->valueArr[0] = value;
@@ -1531,7 +1533,7 @@ static MathFunction mathFunctions[] =
{(char *)NULL,},
};
-void Blt_Vec_InstallMathFunctions(Tcl_HashTable *tablePtr)
+void Blt::Vec_InstallMathFunctions(Tcl_HashTable *tablePtr)
{
MathFunction *mathPtr;
@@ -1544,7 +1546,7 @@ void Blt_Vec_InstallMathFunctions(Tcl_HashTable *tablePtr)
}
}
-void Blt_Vec_UninstallMathFunctions(Tcl_HashTable *tablePtr)
+void Blt::Vec_UninstallMathFunctions(Tcl_HashTable *tablePtr)
{
Tcl_HashEntry *hPtr;
Tcl_HashSearch cursor;
@@ -1570,7 +1572,7 @@ static void InstallIndexProc(Tcl_HashTable *tablePtr, const char *string,
Tcl_SetHashValue(hPtr, (ClientData)procPtr);
}
-void Blt_Vec_InstallSpecialIndices(Tcl_HashTable *tablePtr)
+void Blt::Vec_InstallSpecialIndices(Tcl_HashTable *tablePtr)
{
InstallIndexProc(tablePtr, "min", Blt_VecMin);
InstallIndexProc(tablePtr, "max", Blt_VecMax);
@@ -1579,21 +1581,20 @@ void Blt_Vec_InstallSpecialIndices(Tcl_HashTable *tablePtr)
InstallIndexProc(tablePtr, "prod", Product);
}
-int Blt_ExprVector(Tcl_Interp* interp, char *string, Blt_Vector *vector)
+int Blt::ExprVector(Tcl_Interp* interp, char *string, Blt_Vector *vector)
{
VectorInterpData *dataPtr; /* Interpreter-specific data. */
Vector *vPtr = (Vector *)vector;
Value value;
- dataPtr = (vector != NULL)
- ? vPtr->dataPtr : Blt_Vec_GetInterpData(interp);
- value.vPtr = Blt_Vec_New(dataPtr);
+ dataPtr = (vector != NULL) ? vPtr->dataPtr : Vec_GetInterpData(interp);
+ value.vPtr = Vec_New(dataPtr);
if (EvaluateExpression(interp, string, &value) != TCL_OK) {
- Blt_Vec_Free(value.vPtr);
+ Vec_Free(value.vPtr);
return TCL_ERROR;
}
if (vPtr != NULL) {
- Blt_Vec_Duplicate(vPtr, value.vPtr);
+ Vec_Duplicate(vPtr, value.vPtr);
} else {
Tcl_Obj *listObjPtr;
double *vp, *vend;
@@ -1606,6 +1607,6 @@ int Blt_ExprVector(Tcl_Interp* interp, char *string, Blt_Vector *vector)
}
Tcl_SetObjResult(interp, listObjPtr);
}
- Blt_Vec_Free(value.vPtr);
+ Vec_Free(value.vPtr);
return TCL_OK;
}
diff --git a/src/bltVector.C b/src/bltVector.C
index 735f382..6420ea5 100644
--- a/src/bltVector.C
+++ b/src/bltVector.C
@@ -56,6 +56,8 @@
#include "bltSwitch.h"
#include "bltOp.h"
+using namespace Blt;
+
#define DEF_ARRAY_SIZE 64
#define TRACE_ALL (TCL_TRACE_WRITES | TCL_TRACE_READS | TCL_TRACE_UNSETS)
@@ -116,7 +118,7 @@ typedef int (VectorCmdProc)(Vector* vecObjPtr, Tcl_Interp* interp,
static char stringRep[200];
-const char *Blt_Itoa(int value)
+const char *Blt::Itoa(int value)
{
snprintf(stringRep, 200, "%d", value);
return stringRep;
@@ -136,7 +138,7 @@ static Vector* FindVectorInNamespace(VectorInterpData *dataPtr,
Blt_ObjectName *objNamePtr)
{
Tcl_DString dString;
- const char* name = Blt_MakeQualifiedName(objNamePtr, &dString);
+ const char* name = MakeQualifiedName(objNamePtr, &dString);
Tcl_HashEntry* hPtr = Tcl_FindHashEntry(&dataPtr->vectorTable, name);
Tcl_DStringFree(&dString);
if (hPtr != NULL)
@@ -150,7 +152,7 @@ static Vector* GetVectorObject(VectorInterpData *dataPtr, const char *name,
{
Tcl_Interp* interp = dataPtr->interp;
Blt_ObjectName objName;
- if (!Blt_ParseObjectName(interp, name, &objName, BLT_NO_ERROR_MSG | BLT_NO_DEFAULT_NS))
+ if (!ParseObjectName(interp, name, &objName, BLT_NO_ERROR_MSG | BLT_NO_DEFAULT_NS))
return NULL;
Vector* vPtr = NULL;
@@ -170,7 +172,7 @@ static Vector* GetVectorObject(VectorInterpData *dataPtr, const char *name,
return vPtr;
}
-void Blt_Vec_UpdateRange(Vector* vPtr)
+void Blt::Vec_UpdateRange(Vector* vPtr)
{
double* vp = vPtr->valueArr + vPtr->first;
double* vend = vPtr->valueArr + vPtr->last;
@@ -187,7 +189,7 @@ void Blt_Vec_UpdateRange(Vector* vPtr)
vPtr->notifyFlags &= ~UPDATE_RANGE;
}
-int Blt_Vec_GetIndex(Tcl_Interp* interp, Vector* vPtr, const char *string,
+int Blt::Vec_GetIndex(Tcl_Interp* interp, Vector* vPtr, const char *string,
int *indexPtr, int flags, Blt_VectorIndexProc **procPtrPtr)
{
int value;
@@ -253,8 +255,8 @@ int Blt_Vec_GetIndex(Tcl_Interp* interp, Vector* vPtr, const char *string,
return TCL_OK;
}
-int Blt_Vec_GetIndexRange(Tcl_Interp* interp, Vector* vPtr, const char *string,
- int flags, Blt_VectorIndexProc** procPtrPtr)
+int Blt::Vec_GetIndexRange(Tcl_Interp* interp, Vector* vPtr, const char *string,
+ int flags, Blt_VectorIndexProc** procPtrPtr)
{
int ielem;
char* colon = NULL;
@@ -269,7 +271,7 @@ int Blt_Vec_GetIndexRange(Tcl_Interp* interp, Vector* vPtr, const char *string,
int result;
*colon = '\0';
- result = Blt_Vec_GetIndex(interp, vPtr, string, &ielem, flags,
+ result = Vec_GetIndex(interp, vPtr, string, &ielem, flags,
(Blt_VectorIndexProc **) NULL);
*colon = ':';
if (result != TCL_OK) {
@@ -281,7 +283,7 @@ int Blt_Vec_GetIndexRange(Tcl_Interp* interp, Vector* vPtr, const char *string,
/* Default to the last index */
vPtr->last = (vPtr->length > 0) ? vPtr->length - 1 : 0;
} else {
- if (Blt_Vec_GetIndex(interp, vPtr, colon + 1, &ielem, flags,
+ if (Vec_GetIndex(interp, vPtr, colon + 1, &ielem, flags,
(Blt_VectorIndexProc **) NULL) != TCL_OK) {
return TCL_ERROR;
}
@@ -295,7 +297,7 @@ int Blt_Vec_GetIndexRange(Tcl_Interp* interp, Vector* vPtr, const char *string,
return TCL_ERROR;
}
} else {
- if (Blt_Vec_GetIndex(interp, vPtr, string, &ielem, flags,
+ if (Vec_GetIndex(interp, vPtr, string, &ielem, flags,
procPtrPtr) != TCL_OK) {
return TCL_ERROR;
}
@@ -304,7 +306,7 @@ int Blt_Vec_GetIndexRange(Tcl_Interp* interp, Vector* vPtr, const char *string,
return TCL_OK;
}
-Vector* Blt_Vec_ParseElement(Tcl_Interp* interp, VectorInterpData *dataPtr,
+Vector* Blt::Vec_ParseElement(Tcl_Interp* interp, VectorInterpData *dataPtr,
const char* start, const char** endPtr, int flags)
{
char* p = (char*)start;
@@ -354,8 +356,7 @@ Vector* Blt_Vec_ParseElement(Tcl_Interp* interp, VectorInterpData *dataPtr,
return NULL;
}
*p = '\0';
- result = Blt_Vec_GetIndexRange(interp, vPtr, start,
- (INDEX_COLON | INDEX_CHECK), (Blt_VectorIndexProc **) NULL);
+ result = Vec_GetIndexRange(interp, vPtr, start, (INDEX_COLON | INDEX_CHECK), (Blt_VectorIndexProc **) NULL);
*p = ')';
if (result != TCL_OK) {
return NULL;
@@ -397,7 +398,7 @@ void Blt_Vec_NotifyClients(ClientData clientData)
}
}
-void Blt_Vec_UpdateClients(Vector* vPtr)
+void Blt::Vec_UpdateClients(Vector* vPtr)
{
vPtr->dirty++;
vPtr->max = vPtr->min = NAN;
@@ -415,7 +416,7 @@ void Blt_Vec_UpdateClients(Vector* vPtr)
}
}
-void Blt_Vec_FlushCache(Vector* vPtr)
+void Blt::Vec_FlushCache(Vector* vPtr)
{
Tcl_Interp* interp = vPtr->interp;
@@ -426,7 +427,7 @@ void Blt_Vec_FlushCache(Vector* vPtr)
* elements in the array. */
Tcl_UntraceVar2(interp, vPtr->arrayName, (char *)NULL,
- TRACE_ALL | vPtr->varFlags, Blt_Vec_VarTrace, vPtr);
+ TRACE_ALL | vPtr->varFlags, Vec_VarTrace, vPtr);
/* Clear all the element entries from the entire array */
Tcl_UnsetVar2(interp, vPtr->arrayName, (char *)NULL, vPtr->varFlags);
@@ -434,15 +435,15 @@ void Blt_Vec_FlushCache(Vector* vPtr)
/* Restore the "end" index by default and the trace on the entire array */
Tcl_SetVar2(interp, vPtr->arrayName, "end", "", vPtr->varFlags);
Tcl_TraceVar2(interp, vPtr->arrayName, (char *)NULL,
- TRACE_ALL | vPtr->varFlags, Blt_Vec_VarTrace, vPtr);
+ TRACE_ALL | vPtr->varFlags, Vec_VarTrace, vPtr);
}
-int Blt_Vec_LookupName(VectorInterpData *dataPtr, const char *vecName,
+int Blt::Vec_LookupName(VectorInterpData *dataPtr, const char *vecName,
Vector** vPtrPtr)
{
const char *endPtr;
- Vector* vPtr = Blt_Vec_ParseElement(dataPtr->interp, dataPtr, vecName, &endPtr, NS_SEARCH_BOTH);
+ Vector* vPtr = Vec_ParseElement(dataPtr->interp, dataPtr, vecName, &endPtr, NS_SEARCH_BOTH);
if (vPtr == NULL)
return TCL_ERROR;
@@ -456,7 +457,7 @@ int Blt_Vec_LookupName(VectorInterpData *dataPtr, const char *vecName,
return TCL_OK;
}
-double Blt_Vec_Min(Vector* vecObjPtr)
+double Blt::Vec_Min(Vector* vecObjPtr)
{
double* vp = vecObjPtr->valueArr + vecObjPtr->first;
double* vend = vecObjPtr->valueArr + vecObjPtr->last;
@@ -469,7 +470,7 @@ double Blt_Vec_Min(Vector* vecObjPtr)
return vecObjPtr->min;
}
-double Blt_Vec_Max(Vector* vecObjPtr)
+double Blt::Vec_Max(Vector* vecObjPtr)
{
double max = NAN;
double* vp = vecObjPtr->valueArr + vecObjPtr->first;
@@ -493,8 +494,8 @@ static void DeleteCommand(Vector* vPtr)
Tcl_DStringInit(&dString);
objName.name = Tcl_GetCommandName(interp, vPtr->cmdToken);
- objName.nsPtr = Blt_GetCommandNamespace(vPtr->cmdToken);
- qualName = Blt_MakeQualifiedName(&objName, &dString);
+ objName.nsPtr = GetCommandNamespace(vPtr->cmdToken);
+ qualName = MakeQualifiedName(&objName, &dString);
if (Tcl_GetCommandInfo(interp, qualName, &cmdInfo)) {
// Disable the callback before deleting the TCL command
cmdInfo.deleteProc = NULL;
@@ -511,7 +512,7 @@ static void UnmapVariable(Vector* vPtr)
// Unset the entire array
Tcl_UntraceVar2(interp, vPtr->arrayName, (char *)NULL,
- (TRACE_ALL | vPtr->varFlags), Blt_Vec_VarTrace, vPtr);
+ (TRACE_ALL | vPtr->varFlags), Vec_VarTrace, vPtr);
Tcl_UnsetVar2(interp, vPtr->arrayName, (char *)NULL, vPtr->varFlags);
if (vPtr->arrayName != NULL) {
@@ -520,7 +521,7 @@ static void UnmapVariable(Vector* vPtr)
}
}
-int Blt_Vec_MapVariable(Tcl_Interp* interp, Vector* vPtr, const char *path)
+int Blt::Vec_MapVariable(Tcl_Interp* interp, Vector* vPtr, const char *path)
{
Blt_ObjectName objName;
char *newPath;
@@ -536,7 +537,7 @@ int Blt_Vec_MapVariable(Tcl_Interp* interp, Vector* vPtr, const char *path)
* existing variable. */
}
/* Get the variable name (without the namespace qualifier). */
- if (!Blt_ParseObjectName(interp, path, &objName, BLT_NO_DEFAULT_NS)) {
+ if (!ParseObjectName(interp, path, &objName, BLT_NO_DEFAULT_NS)) {
return TCL_ERROR;
}
if (objName.nsPtr == NULL) {
@@ -544,12 +545,12 @@ int Blt_Vec_MapVariable(Tcl_Interp* interp, Vector* vPtr, const char *path)
* If there was no namespace qualifier, try harder to see if the
* variable is non-local.
*/
- objName.nsPtr = Blt_GetVariableNamespace(interp, objName.name);
+ objName.nsPtr = GetVariableNamespace(interp, objName.name);
}
Tcl_DStringInit(&dString);
vPtr->varFlags = 0;
if (objName.nsPtr != NULL) { /* Global or namespace variable. */
- newPath = Blt_MakeQualifiedName(&objName, &dString);
+ newPath = MakeQualifiedName(&objName, &dString);
vPtr->varFlags |= (TCL_GLOBAL_ONLY);
} else { /* Local variable. */
newPath = (char *)objName.name;
@@ -572,14 +573,14 @@ int Blt_Vec_MapVariable(Tcl_Interp* interp, Vector* vPtr, const char *path)
return TCL_ERROR;
}
/* Create a full-array trace on reads, writes, and unsets. */
- Tcl_TraceVar2(interp, newPath, (char *)NULL, TRACE_ALL, Blt_Vec_VarTrace,
+ Tcl_TraceVar2(interp, newPath, (char *)NULL, TRACE_ALL, Vec_VarTrace,
vPtr);
vPtr->arrayName = Blt_Strdup(newPath);
Tcl_DStringFree(&dString);
return TCL_OK;
}
-int Blt_Vec_SetSize(Tcl_Interp* interp, Vector* vPtr, int newSize)
+int Blt::Vec_SetSize(Tcl_Interp* interp, Vector* vPtr, int newSize)
{
if (newSize <= 0) {
newSize = DEF_ARRAY_SIZE;
@@ -594,7 +595,7 @@ int Blt_Vec_SetSize(Tcl_Interp* interp, Vector* vPtr, int newSize)
if (newArr == NULL) {
if (interp != NULL) {
Tcl_AppendResult(interp, "can't reallocate ",
- Blt_Itoa(newSize), " elements for vector \"",
+ Itoa(newSize), " elements for vector \"",
vPtr->name, "\"", (char *)NULL);
}
return TCL_ERROR;
@@ -612,7 +613,7 @@ int Blt_Vec_SetSize(Tcl_Interp* interp, Vector* vPtr, int newSize)
if (newArr == NULL) {
if (interp != NULL) {
Tcl_AppendResult(interp, "can't allocate ",
- Blt_Itoa(newSize), " elements for vector \"",
+ Itoa(newSize), " elements for vector \"",
vPtr->name, "\"", (char *)NULL);
}
return TCL_ERROR;
@@ -653,10 +654,10 @@ int Blt_Vec_SetSize(Tcl_Interp* interp, Vector* vPtr, int newSize)
return TCL_OK;
}
-int Blt_Vec_SetLength(Tcl_Interp* interp, Vector* vPtr, int newLength)
+int Blt::Vec_SetLength(Tcl_Interp* interp, Vector* vPtr, int newLength)
{
if (vPtr->size < newLength) {
- if (Blt_Vec_SetSize(interp, vPtr, newLength) != TCL_OK) {
+ if (Vec_SetSize(interp, vPtr, newLength) != TCL_OK) {
return TCL_ERROR;
}
}
@@ -666,7 +667,7 @@ int Blt_Vec_SetLength(Tcl_Interp* interp, Vector* vPtr, int newLength)
return TCL_OK;
}
-int Blt_Vec_ChangeLength(Tcl_Interp* interp, Vector* vPtr, int newLength)
+int Blt::Vec_ChangeLength(Tcl_Interp* interp, Vector* vPtr, int newLength)
{
if (newLength < 0) {
newLength = 0;
@@ -681,7 +682,7 @@ int Blt_Vec_ChangeLength(Tcl_Interp* interp, Vector* vPtr, int newLength)
newSize += newSize;
}
if (newSize != vPtr->size) {
- if (Blt_Vec_SetSize(interp, vPtr, newSize) != TCL_OK) {
+ if (Vec_SetSize(interp, vPtr, newSize) != TCL_OK) {
return TCL_ERROR;
}
}
@@ -693,7 +694,7 @@ int Blt_Vec_ChangeLength(Tcl_Interp* interp, Vector* vPtr, int newLength)
}
-int Blt_Vec_Reset(Vector* vPtr, double *valueArr, int length,
+int Blt::Vec_Reset(Vector* vPtr, double *valueArr, int length,
int size, Tcl_FreeProc *freeProc)
{
if (vPtr->valueArr != valueArr) { /* New array of values resides
@@ -705,7 +706,7 @@ int Blt_Vec_Reset(Vector* vPtr, double *valueArr, int length,
size = DEF_ARRAY_SIZE;
if (valueArr == NULL) {
Tcl_AppendResult(vPtr->interp, "can't allocate ",
- Blt_Itoa(size), " elements for vector \"",
+ Itoa(size), " elements for vector \"",
vPtr->name, "\"", (char *)NULL);
return TCL_ERROR;
}
@@ -717,7 +718,7 @@ int Blt_Vec_Reset(Vector* vPtr, double *valueArr, int length,
double* newArr = (double*)malloc(size * sizeof(double));
if (newArr == NULL) {
Tcl_AppendResult(vPtr->interp, "can't allocate ",
- Blt_Itoa(size), " elements for vector \"",
+ Itoa(size), " elements for vector \"",
vPtr->name, "\"", (char *)NULL);
return TCL_ERROR;
}
@@ -743,13 +744,13 @@ int Blt_Vec_Reset(Vector* vPtr, double *valueArr, int length,
vPtr->length = length;
if (vPtr->flush) {
- Blt_Vec_FlushCache(vPtr);
+ Vec_FlushCache(vPtr);
}
- Blt_Vec_UpdateClients(vPtr);
+ Vec_UpdateClients(vPtr);
return TCL_OK;
}
-Vector* Blt_Vec_New(VectorInterpData *dataPtr)
+Vector* Blt::Vec_New(VectorInterpData *dataPtr)
{
Vector* vPtr = (Vector*)calloc(1, sizeof(Vector));
vPtr->valueArr = (double*)malloc(sizeof(double) * DEF_ARRAY_SIZE);
@@ -770,7 +771,7 @@ Vector* Blt_Vec_New(VectorInterpData *dataPtr)
return vPtr;
}
-void Blt_Vec_Free(Vector* vPtr)
+void Blt::Vec_Free(Vector* vPtr)
{
Blt_ChainLink link;
@@ -818,10 +819,10 @@ static void VectorInstDeleteProc(ClientData clientData)
{
Vector* vPtr = (Vector*)clientData;
vPtr->cmdToken = 0;
- Blt_Vec_Free(vPtr);
+ Vec_Free(vPtr);
}
-Vector* Blt_Vec_Create(VectorInterpData *dataPtr, const char *vecName,
+Vector* Blt::Vec_Create(VectorInterpData *dataPtr, const char *vecName,
const char *cmdName, const char *varName, int *isNewPtr)
{
Tcl_DString dString;
@@ -833,7 +834,7 @@ Vector* Blt_Vec_Create(VectorInterpData *dataPtr, const char *vecName,
int isNew = 0;
Vector* vPtr = NULL;
- if (!Blt_ParseObjectName(interp, vecName, &objName, 0))
+ if (!ParseObjectName(interp, vecName, &objName, 0))
return NULL;
Tcl_DStringInit(&dString);
@@ -844,7 +845,7 @@ Vector* Blt_Vec_Create(VectorInterpData *dataPtr, const char *vecName,
snprintf(string, 200, "vector%d", dataPtr->nextId++);
objName.name = string;
- qualName = Blt_MakeQualifiedName(&objName, &dString);
+ qualName = MakeQualifiedName(&objName, &dString);
hPtr = Tcl_FindHashEntry(&dataPtr->vectorTable, qualName);
} while (hPtr != NULL);
} else {
@@ -858,13 +859,13 @@ Vector* Blt_Vec_Create(VectorInterpData *dataPtr, const char *vecName,
goto error;
}
}
- qualName = Blt_MakeQualifiedName(&objName, &dString);
- vPtr = Blt_Vec_ParseElement((Tcl_Interp *)NULL, dataPtr, qualName,
+ qualName = MakeQualifiedName(&objName, &dString);
+ vPtr = Vec_ParseElement((Tcl_Interp *)NULL, dataPtr, qualName,
NULL, NS_SEARCH_CURRENT);
}
if (vPtr == NULL) {
hPtr = Tcl_CreateHashEntry(&dataPtr->vectorTable, qualName, &isNew);
- vPtr = Blt_Vec_New(dataPtr);
+ vPtr = Vec_New(dataPtr);
vPtr->hashPtr = hPtr;
vPtr->nsPtr = objName.nsPtr;
@@ -900,13 +901,13 @@ Vector* Blt_Vec_Create(VectorInterpData *dataPtr, const char *vecName,
Tcl_DStringInit(&dString2);
if (cmdName != qualName) {
- if (!Blt_ParseObjectName(interp, cmdName, &objName, 0)) {
+ if (!ParseObjectName(interp, cmdName, &objName, 0)) {
goto error;
}
- cmdName = Blt_MakeQualifiedName(&objName, &dString2);
+ cmdName = MakeQualifiedName(&objName, &dString2);
}
- vPtr->cmdToken = Tcl_CreateObjCommand(interp, (char *)cmdName,
- Blt_Vec_InstCmd, vPtr, VectorInstDeleteProc);
+ vPtr->cmdToken = Tcl_CreateObjCommand(interp, (char *)cmdName, Vec_InstCmd,
+ vPtr, VectorInstDeleteProc);
Tcl_DStringFree(&dString2);
}
checkVariable:
@@ -914,7 +915,7 @@ Vector* Blt_Vec_Create(VectorInterpData *dataPtr, const char *vecName,
if ((varName[0] == '#') && (strcmp(varName, "#auto") == 0)) {
varName = qualName;
}
- if (Blt_Vec_MapVariable(interp, vPtr, varName) != TCL_OK) {
+ if (Vec_MapVariable(interp, vPtr, varName) != TCL_OK) {
goto error;
}
}
@@ -926,12 +927,12 @@ Vector* Blt_Vec_Create(VectorInterpData *dataPtr, const char *vecName,
error:
Tcl_DStringFree(&dString);
if (vPtr != NULL) {
- Blt_Vec_Free(vPtr);
+ Vec_Free(vPtr);
}
return NULL;
}
-int Blt_Vec_Duplicate(Vector* destPtr, Vector* srcPtr)
+int Blt::Vec_Duplicate(Vector* destPtr, Vector* srcPtr)
{
size_t nBytes;
size_t length;
@@ -940,7 +941,7 @@ int Blt_Vec_Duplicate(Vector* destPtr, Vector* srcPtr)
/* Copying the same vector. */
}
length = srcPtr->last - srcPtr->first + 1;
- if (Blt_Vec_ChangeLength(destPtr->interp, destPtr, length) != TCL_OK) {
+ if (Vec_ChangeLength(destPtr->interp, destPtr, length) != TCL_OK) {
return TCL_ERROR;
}
nBytes = length * sizeof(double);
@@ -1017,7 +1018,7 @@ static int VectorCreate2(ClientData clientData, Tcl_Interp* interp,
return TCL_ERROR;
}
memset(&switches, 0, sizeof(switches));
- if (Blt_ParseSwitches(interp, createSwitches, objc - i, objv + i,
+ if (ParseSwitches(interp, createSwitches, objc - i, objv + i,
&switches, BLT_SWITCH_DEFAULTS) < 0) {
return TCL_ERROR;
}
@@ -1093,7 +1094,7 @@ static int VectorCreate2(ClientData clientData, Tcl_Interp* interp,
/*
* By default, we create a TCL command by the name of the vector.
*/
- vPtr = Blt_Vec_Create(dataPtr, string,
+ vPtr = Vec_Create(dataPtr, string,
(switches.cmdName == NULL) ? string : switches.cmdName,
(switches.varName == NULL) ? string : switches.varName, &isNew);
if (leftParen != NULL) {
@@ -1106,25 +1107,25 @@ static int VectorCreate2(ClientData clientData, Tcl_Interp* interp,
vPtr->flush = switches.flush;
vPtr->offset = first;
if (size > 0) {
- if (Blt_Vec_ChangeLength(interp, vPtr, size) != TCL_OK) {
+ if (Vec_ChangeLength(interp, vPtr, size) != TCL_OK) {
goto error;
}
}
if (!isNew) {
if (vPtr->flush) {
- Blt_Vec_FlushCache(vPtr);
+ Vec_FlushCache(vPtr);
}
- Blt_Vec_UpdateClients(vPtr);
+ Vec_UpdateClients(vPtr);
}
}
- Blt_FreeSwitches(createSwitches, (char *)&switches, 0);
+ FreeSwitches(createSwitches, (char *)&switches, 0);
if (vPtr != NULL) {
/* Return the name of the last vector created */
Tcl_SetStringObj(Tcl_GetObjResult(interp), vPtr->name, -1);
}
return TCL_OK;
error:
- Blt_FreeSwitches(createSwitches, (char *)&switches, 0);
+ FreeSwitches(createSwitches, (char *)&switches, 0);
return TCL_ERROR;
}
@@ -1141,9 +1142,9 @@ static int VectorDestroyOp(ClientData clientData, Tcl_Interp* interp,
for (int ii=2; ii<objc; ii++) {
Vector* vPtr;
- if (Blt_Vec_LookupName(dataPtr, Tcl_GetString(objv[ii]), &vPtr) != TCL_OK)
+ if (Vec_LookupName(dataPtr, Tcl_GetString(objv[ii]), &vPtr) != TCL_OK)
return TCL_ERROR;
- Blt_Vec_Free(vPtr);
+ Vec_Free(vPtr);
}
return TCL_OK;
}
@@ -1151,7 +1152,7 @@ static int VectorDestroyOp(ClientData clientData, Tcl_Interp* interp,
static int VectorExprOp(ClientData clientData, Tcl_Interp* interp,
int objc, Tcl_Obj* const objv[])
{
- return Blt_ExprVector(interp, Tcl_GetString(objv[2]), (Blt_Vector* )NULL);
+ return ExprVector(interp, Tcl_GetString(objv[2]), (Blt_Vector* )NULL);
}
static Blt_OpSpec vectorCmdOps[] =
@@ -1191,8 +1192,8 @@ static int VectorCmd(ClientData clientData, Tcl_Interp* interp,
}
doOp:
/* Do the usual vector operation lookup now. */
- proc = (VectorCmdProc*)Blt_GetOpFromObj(interp, nCmdOps, vectorCmdOps, BLT_OP_ARG1,
- objc, objv,0);
+ proc = (VectorCmdProc*)GetOpFromObj(interp, nCmdOps, vectorCmdOps,
+ BLT_OP_ARG1, objc, objv,0);
if (proc == NULL) {
return TCL_ERROR;
}
@@ -1209,12 +1210,12 @@ static void VectorInterpDeleteProc(ClientData clientData, Tcl_Interp* interp)
hPtr != NULL; hPtr = Tcl_NextHashEntry(&cursor)) {
Vector* vPtr = (Vector*)Tcl_GetHashValue(hPtr);
vPtr->hashPtr = NULL;
- Blt_Vec_Free(vPtr);
+ Vec_Free(vPtr);
}
Tcl_DeleteHashTable(&dataPtr->vectorTable);
/* If any user-defined math functions were installed, remove them. */
- Blt_Vec_UninstallMathFunctions(&dataPtr->mathProcTable);
+ Vec_UninstallMathFunctions(&dataPtr->mathProcTable);
Tcl_DeleteHashTable(&dataPtr->mathProcTable);
Tcl_DeleteHashTable(&dataPtr->indexProcTable);
@@ -1222,7 +1223,7 @@ static void VectorInterpDeleteProc(ClientData clientData, Tcl_Interp* interp)
free(dataPtr);
}
-VectorInterpData *Blt_Vec_GetInterpData(Tcl_Interp* interp)
+VectorInterpData* Blt::Vec_GetInterpData(Tcl_Interp* interp)
{
VectorInterpData *dataPtr;
Tcl_InterpDeleteProc *proc;
@@ -1238,8 +1239,8 @@ VectorInterpData *Blt_Vec_GetInterpData(Tcl_Interp* interp)
Tcl_InitHashTable(&dataPtr->vectorTable, TCL_STRING_KEYS);
Tcl_InitHashTable(&dataPtr->mathProcTable, TCL_STRING_KEYS);
Tcl_InitHashTable(&dataPtr->indexProcTable, TCL_STRING_KEYS);
- Blt_Vec_InstallMathFunctions(&dataPtr->mathProcTable);
- Blt_Vec_InstallSpecialIndices(&dataPtr->indexProcTable);
+ Vec_InstallMathFunctions(&dataPtr->mathProcTable);
+ Vec_InstallSpecialIndices(&dataPtr->indexProcTable);
srand48(time((time_t *) NULL));
}
return dataPtr;
@@ -1259,7 +1260,7 @@ int Blt_VectorCmdInitProc(Tcl_Interp* interp)
if (cmdToken)
return TCL_OK;
cmdToken = Tcl_CreateObjCommand(interp, cmdPath, VectorCmd,
- Blt_Vec_GetInterpData(interp), NULL);
+ Vec_GetInterpData(interp), NULL);
if (Tcl_Export(interp, nsPtr, "vector", 0) != TCL_OK)
return TCL_ERROR;
@@ -1278,21 +1279,21 @@ int Blt_CreateVector2(Tcl_Interp* interp, const char *vecName,
char *nameCopy;
if (initialSize < 0) {
- Tcl_AppendResult(interp, "bad vector size \"", Blt_Itoa(initialSize),
+ Tcl_AppendResult(interp, "bad vector size \"", Itoa(initialSize),
"\"", (char *)NULL);
return TCL_ERROR;
}
- dataPtr = Blt_Vec_GetInterpData(interp);
+ dataPtr = Vec_GetInterpData(interp);
nameCopy = Blt_Strdup(vecName);
- vPtr = Blt_Vec_Create(dataPtr, nameCopy, cmdName, varName, &isNew);
+ vPtr = Vec_Create(dataPtr, nameCopy, cmdName, varName, &isNew);
free(nameCopy);
if (vPtr == NULL) {
return TCL_ERROR;
}
if (initialSize > 0) {
- if (Blt_Vec_ChangeLength(interp, vPtr, initialSize) != TCL_OK) {
+ if (Vec_ChangeLength(interp, vPtr, initialSize) != TCL_OK) {
return TCL_ERROR;
}
}
@@ -1312,25 +1313,25 @@ int Blt_DeleteVector(Blt_Vector* vecPtr)
{
Vector* vPtr = (Vector* )vecPtr;
- Blt_Vec_Free(vPtr);
+ Vec_Free(vPtr);
return TCL_OK;
}
int Blt_DeleteVectorByName(Tcl_Interp* interp, const char *name)
{
// If the vector name was passed via a read-only string (e.g. "x"), the
- // Blt_Vec_ParseElement routine will segfault when it tries to write into
+ // Vec_ParseElement routine will segfault when it tries to write into
// the string. Therefore make a writable copy and free it when we're done.
char* nameCopy = Blt_Strdup(name);
- VectorInterpData *dataPtr = Blt_Vec_GetInterpData(interp);
+ VectorInterpData *dataPtr = Vec_GetInterpData(interp);
Vector* vPtr;
- int result = Blt_Vec_LookupName(dataPtr, nameCopy, &vPtr);
+ int result = Vec_LookupName(dataPtr, nameCopy, &vPtr);
free(nameCopy);
if (result != TCL_OK)
return TCL_ERROR;
- Blt_Vec_Free(vPtr);
+ Vec_Free(vPtr);
return TCL_OK;
}
@@ -1338,7 +1339,7 @@ int Blt_VectorExists2(Tcl_Interp* interp, const char *vecName)
{
VectorInterpData *dataPtr;
- dataPtr = Blt_Vec_GetInterpData(interp);
+ dataPtr = Vec_GetInterpData(interp);
if (GetVectorObject(dataPtr, vecName, NS_SEARCH_BOTH) != NULL) {
return 1;
}
@@ -1369,7 +1370,7 @@ int Blt_GetVector(Tcl_Interp* interp, const char *name, Blt_Vector* *vecPtrPtr)
char *nameCopy;
int result;
- dataPtr = Blt_Vec_GetInterpData(interp);
+ dataPtr = Vec_GetInterpData(interp);
/*
* If the vector name was passed via a read-only string (e.g. "x"), the
* Blt_VectorParseName routine will segfault when it tries to write into
@@ -1377,12 +1378,12 @@ int Blt_GetVector(Tcl_Interp* interp, const char *name, Blt_Vector* *vecPtrPtr)
* done.
*/
nameCopy = Blt_Strdup(name);
- result = Blt_Vec_LookupName(dataPtr, nameCopy, &vPtr);
+ result = Vec_LookupName(dataPtr, nameCopy, &vPtr);
free(nameCopy);
if (result != TCL_OK) {
return TCL_ERROR;
}
- Blt_Vec_UpdateRange(vPtr);
+ Vec_UpdateRange(vPtr);
*vecPtrPtr = (Blt_Vector* ) vPtr;
return TCL_OK;
}
@@ -1393,11 +1394,11 @@ int Blt_GetVectorFromObj(Tcl_Interp* interp, Tcl_Obj *objPtr,
VectorInterpData *dataPtr; /* Interpreter-specific data. */
Vector* vPtr;
- dataPtr = Blt_Vec_GetInterpData(interp);
- if (Blt_Vec_LookupName(dataPtr, Tcl_GetString(objPtr), &vPtr) != TCL_OK) {
+ dataPtr = Vec_GetInterpData(interp);
+ if (Vec_LookupName(dataPtr, Tcl_GetString(objPtr), &vPtr) != TCL_OK) {
return TCL_ERROR;
}
- Blt_Vec_UpdateRange(vPtr);
+ Vec_UpdateRange(vPtr);
*vecPtrPtr = (Blt_Vector* ) vPtr;
return TCL_OK;
}
@@ -1411,22 +1412,22 @@ int Blt_ResetVector(Blt_Vector* vecPtr, double *valueArr, int length,
Tcl_AppendResult(vPtr->interp, "bad array size", (char *)NULL);
return TCL_ERROR;
}
- return Blt_Vec_Reset(vPtr, valueArr, length, size, freeProc);
+ return Vec_Reset(vPtr, valueArr, length, size, freeProc);
}
int Blt_ResizeVector(Blt_Vector* vecPtr, int length)
{
Vector* vPtr = (Vector* )vecPtr;
- if (Blt_Vec_ChangeLength((Tcl_Interp *)NULL, vPtr, length) != TCL_OK) {
+ if (Vec_ChangeLength((Tcl_Interp *)NULL, vPtr, length) != TCL_OK) {
Tcl_AppendResult(vPtr->interp, "can't resize vector \"", vPtr->name,
"\"", (char *)NULL);
return TCL_ERROR;
}
if (vPtr->flush) {
- Blt_Vec_FlushCache(vPtr);
+ Vec_FlushCache(vPtr);
}
- Blt_Vec_UpdateClients(vPtr);
+ Vec_UpdateClients(vPtr);
return TCL_OK;
}
@@ -1439,7 +1440,7 @@ Blt_VectorId Blt_AllocVectorId(Tcl_Interp* interp, const char *name)
int result;
char *nameCopy;
- dataPtr = Blt_Vec_GetInterpData(interp);
+ dataPtr = Vec_GetInterpData(interp);
/*
* If the vector name was passed via a read-only string (e.g. "x"), the
* Blt_VectorParseName routine will segfault when it tries to write into
@@ -1447,7 +1448,7 @@ Blt_VectorId Blt_AllocVectorId(Tcl_Interp* interp, const char *name)
* done.
*/
nameCopy = Blt_Strdup(name);
- result = Blt_Vec_LookupName(dataPtr, nameCopy, &vPtr);
+ result = Vec_LookupName(dataPtr, nameCopy, &vPtr);
free(nameCopy);
if (result != TCL_OK) {
@@ -1507,17 +1508,6 @@ const char* Blt_NameOfVector(Blt_Vector* vecPtr) /* Vector to query. */
return vPtr->name;
}
-int Blt_VectorNotifyPending(Blt_VectorId clientId)
-{
- VectorClient *clientPtr = (VectorClient *)clientId;
-
- if ((clientPtr == NULL) || (clientPtr->magic != VECTOR_MAGIC) ||
- (clientPtr->serverPtr == NULL)) {
- return 0;
- }
- return (clientPtr->serverPtr->notifyFlags & NOTIFY_PENDING);
-}
-
int Blt_GetVectorById(Tcl_Interp* interp, Blt_VectorId clientId,
Blt_Vector* *vecPtrPtr)
{
@@ -1531,7 +1521,7 @@ int Blt_GetVectorById(Tcl_Interp* interp, Blt_VectorId clientId,
Tcl_AppendResult(interp, "vector no longer exists", (char *)NULL);
return TCL_ERROR;
}
- Blt_Vec_UpdateRange(clientPtr->serverPtr);
+ Vec_UpdateRange(clientPtr->serverPtr);
*vecPtrPtr = (Blt_Vector* ) clientPtr->serverPtr;
return TCL_OK;
}
@@ -1543,7 +1533,7 @@ void Blt_InstallIndexProc(Tcl_Interp* interp, const char *string,
Tcl_HashEntry *hPtr;
int isNew;
- dataPtr = Blt_Vec_GetInterpData(interp);
+ dataPtr = Vec_GetInterpData(interp);
hPtr = Tcl_CreateHashEntry(&dataPtr->indexProcTable, string, &isNew);
if (procPtr == NULL) {
Tcl_DeleteHashEntry(hPtr);
@@ -1618,7 +1608,7 @@ smallest_power_of_2_not_less_than(int x)
return pow2;
}
-int Blt_Vec_FFT(Tcl_Interp* interp, Vector* realPtr, Vector* phasesPtr,
+int Blt::Vec_FFT(Tcl_Interp* interp, Vector* realPtr, Vector* phasesPtr,
Vector* freqPtr, double delta, int flags, Vector* srcPtr)
{
int length;
@@ -1649,7 +1639,7 @@ int Blt_Vec_FFT(Tcl_Interp* interp, Vector* realPtr, Vector* phasesPtr,
"\" can't be the same as the source", (char *)NULL);
return TCL_ERROR;
}
- if (Blt_Vec_ChangeLength(interp, phasesPtr,
+ if (Vec_ChangeLength(interp, phasesPtr,
pow2len/2-noconstant+middle) != TCL_OK) {
return TCL_ERROR;
}
@@ -1660,7 +1650,7 @@ int Blt_Vec_FFT(Tcl_Interp* interp, Vector* realPtr, Vector* phasesPtr,
"\" can't be the same as the source", (char *)NULL);
return TCL_ERROR;
}
- if (Blt_Vec_ChangeLength(interp, freqPtr,
+ if (Vec_ChangeLength(interp, freqPtr,
pow2len/2-noconstant+middle) != TCL_OK) {
return TCL_ERROR;
}
@@ -1760,7 +1750,7 @@ int Blt_Vec_FFT(Tcl_Interp* interp, Vector* realPtr, Vector* phasesPtr,
}
-int Blt_Vec_InverseFFT(Tcl_Interp* interp, Vector* srcImagPtr,
+int Blt::Vec_InverseFFT(Tcl_Interp* interp, Vector* srcImagPtr,
Vector* destRealPtr, Vector* destImagPtr, Vector* srcPtr)
{
int length;
@@ -1779,10 +1769,10 @@ int Blt_Vec_InverseFFT(Tcl_Interp* interp, Vector* srcImagPtr,
pow2len = smallest_power_of_2_not_less_than( (length-1)*2 );
oneOverN = 1.0 / pow2len;
- if (Blt_Vec_ChangeLength(interp, destRealPtr, pow2len) != TCL_OK) {
+ if (Vec_ChangeLength(interp, destRealPtr, pow2len) != TCL_OK) {
return TCL_ERROR;
}
- if (Blt_Vec_ChangeLength(interp, destImagPtr, pow2len) != TCL_OK) {
+ if (Vec_ChangeLength(interp, destImagPtr, pow2len) != TCL_OK) {
return TCL_ERROR;
}
diff --git a/src/bltVector.h b/src/bltVector.h
index b0be76d..04d5b1d 100644
--- a/src/bltVector.h
+++ b/src/bltVector.h
@@ -87,29 +87,40 @@ typedef enum {
#define Blt_VecSize(v) ((v)->arraySize)
#define Blt_VecDirty(v) ((v)->dirty)
+namespace Blt {
+ extern int ExprVector(Tcl_Interp* interp, char *expr, Blt_Vector *vecPtr);
+};
+
extern "C" {
- int Blt_CreateVector(Tcl_Interp* interp, const char *vecName, int size, Blt_Vector ** vecPtrPtr);
- int Blt_CreateVector2(Tcl_Interp* interp, const char *vecName, const char *cmdName, const char *varName, int initialSize, Blt_Vector **vecPtrPtr);
+ int Blt_CreateVector(Tcl_Interp* interp, const char *vecName,
+ int size, Blt_Vector** vecPtrPtr);
+ int Blt_CreateVector2(Tcl_Interp* interp, const char *vecName,
+ const char *cmdName, const char *varName,
+ int initialSize, Blt_Vector **vecPtrPtr);
int Blt_DeleteVectorByName(Tcl_Interp* interp, const char *vecName);
int Blt_DeleteVector(Blt_Vector *vecPtr);
- int Blt_GetVector(Tcl_Interp* interp, const char *vecName, Blt_Vector **vecPtrPtr);
- int Blt_GetVectorFromObj(Tcl_Interp* interp, Tcl_Obj *objPtr, Blt_Vector **vecPtrPtr);
- int Blt_ResetVector(Blt_Vector *vecPtr, double *dataArr, int n, int arraySize, Tcl_FreeProc *freeProc);
+ int Blt_GetVector(Tcl_Interp* interp, const char *vecName,
+ Blt_Vector **vecPtrPtr);
+ int Blt_GetVectorFromObj(Tcl_Interp* interp, Tcl_Obj *objPtr,
+ Blt_Vector **vecPtrPtr);
+ int Blt_ResetVector(Blt_Vector *vecPtr, double *dataArr, int n,
+ int arraySize, Tcl_FreeProc *freeProc);
int Blt_ResizeVector(Blt_Vector *vecPtr, int n);
int Blt_VectorExists(Tcl_Interp* interp, const char *vecName);
int Blt_VectorExists2(Tcl_Interp* interp, const char *vecName);
Blt_VectorId Blt_AllocVectorId(Tcl_Interp* interp, const char *vecName);
- int Blt_GetVectorById(Tcl_Interp* interp, Blt_VectorId clientId, Blt_Vector **vecPtrPtr);
- void Blt_SetVectorChangedProc(Blt_VectorId clientId, Blt_VectorChangedProc *proc, ClientData clientData);
+ int Blt_GetVectorById(Tcl_Interp* interp, Blt_VectorId clientId,
+ Blt_Vector **vecPtrPtr);
+ void Blt_SetVectorChangedProc(Blt_VectorId clientId,
+ Blt_VectorChangedProc *proc,
+ ClientData clientData);
void Blt_FreeVectorId(Blt_VectorId clientId);
const char *Blt_NameOfVectorId(Blt_VectorId clientId);
const char *Blt_NameOfVector(Blt_Vector *vecPtr);
- void Blt_InstallIndexProc(Tcl_Interp* interp, const char *indexName, Blt_VectorIndexProc * procPtr);
+ void Blt_InstallIndexProc(Tcl_Interp* interp, const char *indexName,
+ Blt_VectorIndexProc * procPtr);
+ double Blt_VecMin(Blt_Vector *vPtr);
+ double Blt_VecMax(Blt_Vector *vPtr);
}
-extern double Blt_VecMin(Blt_Vector *vPtr);
-extern double Blt_VecMax(Blt_Vector *vPtr);
-extern int Blt_VectorNotifyPending(Blt_VectorId clientId);
-extern int Blt_ExprVector(Tcl_Interp* interp, char *expr, Blt_Vector *vecPtr);
-
#endif /* _BLT_VECTOR_H */