Changeset 20936 for trunk/Ohana/src/opihi/include/dvomath.h
- Timestamp:
- Dec 7, 2008, 3:31:01 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/include/dvomath.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/include/dvomath.h
r15878 r20936 4 4 # define DVOMATH_H 5 5 6 # define OPIHI_NAME_SIZE 1024 7 6 8 # define NCHARS 256 9 # define opihi_flt double 10 # define opihi_int int 11 // NOTE: if opihi_int is changed to unsigned, all subtraction and negation operations 12 // need to result in a float value (or 3 - 5 will yield the unexpected value 2^32 - 2) 13 14 # define REQUIRE_VECTOR_FLT(VECT,RVAL) { \ 15 if (VECT->type != OPIHI_FLT) { \ 16 gprint (GP_ERR, "function requires vector of type FLT\n"); \ 17 return (RVAL); \ 18 } } 19 20 # define REQUIRE_VECTOR_INT(VECT,RVAL) { \ 21 if (VECT->type != OPIHI_INT) { \ 22 gprint (GP_ERR, "function requires vector of type INT\n"); \ 23 return (RVAL); \ 24 } } 7 25 8 26 enum {ANYVECTOR, NEWVECTOR, OLDVECTOR}; 9 27 enum {ANYBUFFER, NEWBUFFER, OLDBUFFER}; 28 enum {OPIHI_FLT, OPIHI_INT}; 10 29 11 30 typedef struct { /* representation of a variable (0-D) */ … … 15 34 16 35 typedef struct { /* representation of a vector (1-D) */ 17 char name[1024]; 18 float *elements; 36 char name[OPIHI_NAME_SIZE]; 37 char type; 38 union { 39 void *Ptr; 40 opihi_flt *Flt; 41 opihi_int *Int; 42 } elements; 19 43 int Nelements; 20 44 } Vector; 21 45 22 46 typedef struct { /* representation of buffer (image) */ 23 char name[ 1024];24 char file[ 1024];47 char name[OPIHI_NAME_SIZE]; 48 char file[OPIHI_NAME_SIZE]; 25 49 Header header; 26 50 Matrix matrix; … … 32 56 char *name; 33 57 char type; 34 float *ptr;35 58 Buffer *buffer; 36 59 Vector *vector; 37 float Float; 60 opihi_flt FltValue; 61 opihi_int IntValue; 38 62 } StackVar; 39 63 … … 87 111 void InitVectors PROTO((void)); 88 112 int CopyVector PROTO((Vector *out, Vector *in)); 113 int ResetVector PROTO((Vector *vec, char type, int Nelements)); 114 int SetVector PROTO((Vector *vec, char type, int Nelements)); 115 int CastVector PROTO((Vector *vec, char type)); 116 int MatchVector PROTO((Vector *out, Vector *in, char type)); 89 117 int MoveVector PROTO((Vector *out, Vector *in)); 90 118 int DeleteVector PROTO((Vector *vec));
Note:
See TracChangeset
for help on using the changeset viewer.
