summaryrefslogtreecommitdiffstats
path: root/src/bltVecInt.h
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 /src/bltVecInt.h
parentd9392c93890e89f29b64c963e8ff39c6e8d402a9 (diff)
downloadblt-d94450a5cfe4e5e7117cdc87e20d906f843e9990.zip
blt-d94450a5cfe4e5e7117cdc87e20d906f843e9990.tar.gz
blt-d94450a5cfe4e5e7117cdc87e20d906f843e9990.tar.bz2
*** empty log message ***
Diffstat (limited to 'src/bltVecInt.h')
-rw-r--r--src/bltVecInt.h246
1 files changed, 101 insertions, 145 deletions
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;