Debian Codegraph @

generic/bltVector.h

raw symbols SCIP
1
2 /*
3 * bltVector.h --
4 *
5 * Copyright 1993-2000 Lucent Technologies, Inc.
6 *
7 * Permission to use, copy, modify, and distribute this software and
8 * its documentation for any purpose and without fee is hereby
9 * granted, provided that the above copyright notice appear in all
10 * copies and that both that the copyright notice and warranty
11 * disclaimer appear in supporting documentation, and that the names
12 * of Lucent Technologies any of their entities not be used in
13 * advertising or publicity pertaining to distribution of the software
14 * without specific, written prior permission.
15 *
16 * Lucent Technologies disclaims all warranties with regard to this
17 * software, including all implied warranties of merchantability and
18 * fitness. In no event shall Lucent Technologies be liable for any
19 * special, indirect or consequential damages or any damages
20 * whatsoever resulting from loss of use, data or profits, whether in
21 * an action of contract, negligence or other tortuous action, arising
22 * out of or in connection with the use or performance of this
23 * software.
24 */
25
26 #ifndef _BLT_VECTOR_H
27 #define _BLT_VECTOR_H
28
29 typedef enum {
30 BLT_VECTOR_NOTIFY_UPDATE = 1, /* The vector's values has been updated */
31 BLT_VECTOR_NOTIFY_DESTROY /* The vector has been destroyed and the client
32 * should no longer use its data (calling
33 * Blt_FreeVectorId) */
34 } Blt_VectorNotify;
35
36 typedef struct Blt_VectorIdStruct *Blt_VectorId;
37
38 typedef void (Blt_VectorChangedProc) _ANSI_ARGS_((Tcl_Interp *interp,
39 ClientData clientData, Blt_VectorNotify notify));
40
41 typedef struct {
42 double *valueArr; /* Array of values (possibly malloc-ed) */
43 int numValues; /* Number of values in the array */
44 int arraySize; /* Size of the allocated space */
45 double min, max; /* Minimum and maximum values in the vector */
46 int dirty; /* Indicates if the vector has been updated */
47 int reserved; /* Reserved for future use */
48 } Blt_Vector;
49
50 typedef double (Blt_VectorIndexProc) _ANSI_ARGS_((Blt_Vector * vecPtr));
51
52 typedef enum {
53 BLT_MATH_FUNC_SCALAR = 1, /* The function returns a single double
54 * precision value. */
55 BLT_MATH_FUNC_VECTOR, /* The function processes the entire vector. */
56 BLT_MATH_FUNC_MATRIX /* The function processes as a matrix. */
57 } Blt_MathFuncType;
58
59 /*
60 * To be safe, use the macros below, rather than the fields of the
61 * structure directly.
62 *
63 * The Blt_Vector is basically an opaque type. But it's also the
64 * actual memory address of the vector itself. I wanted to make the
65 * API as unobtrusive as possible. So instead of giving you a copy of
66 * the vector, providing various functions to access and update the
67 * vector, you get your hands on the actual memory (array of doubles)
68 * shared by all the vector's clients.
69 *
70 * The trade-off for speed and convenience is safety. You can easily
71 * break things by writing into the vector when other clients are
72 * using it. Use Blt_ResetVector to get around this. At least the
73 * macros are a reminder it isn't really safe to reset the data
74 * fields, except by the API routines.
75 */
76 #define Blt_VecData(v) ((v)->valueArr)
77 #define Blt_VecLength(v) ((v)->numValues)
78 #define Blt_VecSize(v) ((v)->arraySize)
79 #define Blt_VecDirty(v) ((v)->dirty)
80
81 #ifndef USE_BLT_STUBS
82
83 EXTERN double Blt_VecMin _ANSI_ARGS_((Blt_Vector *vPtr));
84 EXTERN double Blt_VecMax _ANSI_ARGS_((Blt_Vector *vPtr));
85
86 EXTERN Blt_VectorId Blt_AllocVectorId _ANSI_ARGS_((Tcl_Interp *interp,
87 char *vecName));
88
89 EXTERN void Blt_SetVectorChangedProc _ANSI_ARGS_((Blt_VectorId clientId,
90 Blt_VectorChangedProc * proc, ClientData clientData));
91
92 EXTERN void Blt_FreeVectorId _ANSI_ARGS_((Blt_VectorId clientId));
93
94 EXTERN int Blt_GetVectorById _ANSI_ARGS_((Tcl_Interp *interp,
95 Blt_VectorId clientId, Blt_Vector **vecPtrPtr));
96
97 EXTERN char *Blt_NameOfVectorId _ANSI_ARGS_((Blt_VectorId clientId));
98
99 EXTERN char *Blt_NameOfVector _ANSI_ARGS_((Blt_Vector *vecPtr));
100
101 EXTERN int Blt_VectorNotifyPending _ANSI_ARGS_((Blt_VectorId clientId));
102
103 EXTERN int Blt_CreateVector _ANSI_ARGS_((Tcl_Interp *interp, char *vecName,
104 int size, Blt_Vector ** vecPtrPtr));
105
106 EXTERN int Blt_CreateVector2 _ANSI_ARGS_((Tcl_Interp *interp, char *vecName,
107 char *cmdName, char *varName, int size, Blt_Vector ** vecPtrPtr));
108
109 EXTERN int Blt_GetVector _ANSI_ARGS_((Tcl_Interp *interp, char *vecName,
110 Blt_Vector **vecPtrPtr));
111
112 EXTERN int Blt_VectorExists _ANSI_ARGS_((Tcl_Interp *interp, char *vecName));
113
114 EXTERN int Blt_ResetVector _ANSI_ARGS_((Blt_Vector *vecPtr, double *dataArr,
115 int nValues, int arraySize, Tcl_FreeProc *freeProc));
116
117 EXTERN int Blt_ResizeVector _ANSI_ARGS_((Blt_Vector *vecPtr, int nValues));
118
119 EXTERN int Blt_DeleteVectorByName _ANSI_ARGS_((Tcl_Interp *interp,
120 char *vecName));
121
122 EXTERN int Blt_DeleteVector _ANSI_ARGS_((Blt_Vector *vecPtr));
123
124 EXTERN int Blt_ExprVector _ANSI_ARGS_((Tcl_Interp *interp, char *expression,
125 Blt_Vector *vecPtr));
126
127 EXTERN void Blt_InstallIndexProc _ANSI_ARGS_((Tcl_Interp *interp,
128 char *indexName, Blt_VectorIndexProc * procPtr));
129
130 #else
131 #include "bltDecls.h"
132 #endif /* USE_BLT_STUBS */
133 #endif /* _BLT_VECTOR_H */