~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina6/tina-libs/tina/sys/sys_GenDef.h

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**********
  2  * 
  3  * Copyright (c) 2003, Division of Imaging Science and Biomedical Engineering,
  4  * University of Manchester, UK.  All rights reserved.
  5  * 
  6  * Redistribution and use in source and binary forms, with or without modification, 
  7  * are permitted provided that the following conditions are met:
  8  * 
  9  *   . Redistributions of source code must retain the above copyright notice, 
 10  *     this list of conditions and the following disclaimer.
 11  *    
 12  *   . Redistributions in binary form must reproduce the above copyright notice,
 13  *     this list of conditions and the following disclaimer in the documentation 
 14  *     and/or other materials provided with the distribution.
 15  * 
 16  *   . Neither the name of the University of Manchester nor the names of its
 17  *     contributors may be used to endorse or promote products derived from this 
 18  *     software without specific prior written permission.
 19  * 
 20  * 
 21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
 22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
 25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 31  * POSSIBILITY OF SUCH DAMAGE.
 32  *
 33  **********
 34  * 
 35  * Program :    TINA
 36  * File    :  $Source: /home/tina/cvs/tina-libs/tina/sys/sys_GenDef.h,v $
 37  * Date    :  $Date: 2003/09/22 16:09:02 $
 38  * Version :  $Revision: 1.5 $
 39  * CVS Id  :  $Id: sys_GenDef.h,v 1.5 2003/09/22 16:09:02 tony Exp $
 40  *
 41  * Notes :
 42  *
 43  *********
 44  */
 45 
 46 #ifndef TINA_SYS_GEN_DEF_HDR
 47 #define TINA_SYS_GEN_DEF_HDR
 48 
 49 #ifdef IBM
 50 #undef NULL
 51 #define NULL 0
 52 #endif
 53 
 54 /* next line added by JULIAN 19/10/93 to ensure NULL alway 0 NOT (void*)0 */
 55 /* quelle twat. removed
 56 #undef NULL
 57 #ifndef NULL
 58 #define NULL 0
 59 #endif
 60 */
 61 
 62 /** absolute value macro */
 63 
 64 #ifndef ABS
 65 #define ABS(x) ((x) < 0 ? -(x): (x))
 66 #endif
 67 
 68 /** sign macros */
 69 
 70 #ifndef SGN
 71 #define SGN(x) ((x) < 0 ? -1: 1)
 72 #endif
 73 
 74 #ifndef SAME_SIGN
 75 #define SAME_SIGN(x, y) ((x)<0 ? (y)<0 : (y)>=0)
 76 #endif
 77 
 78 #ifndef DIFF_SIGN
 79 #define DIFF_SIGN(x, y) ((x)<0 ? (y)>=0 : (y)<0)
 80 #endif
 81 
 82 /** round to nearest integer **/
 83 #ifndef ROUND
 84 #define ROUND(x) ((x) > 0? (int) ((x)+0.5): -(int)(0.5-(x)))
 85 #endif
 86 
 87 /** sqr macro */
 88 
 89 #ifndef SQR
 90 #define SQR(x) ((x)*(x))
 91 #endif
 92 
 93 /** macro to swap arbitrary types **/
 94 
 95 #ifndef SWAP    
 96 #define SWAP(var,x,y) { var temp; temp = (x); (x) = (y); (y) = temp; }
 97 #endif
 98 
 99 /** macro to order arbitrary types **/
100 
101 #ifndef ORDER
102 #define ORDER(var,x,y) if ((y)<(x)) { var temp; temp = (x); (x) = (y); (y) = temp; }
103 #endif
104 
105 /** maximum and minimum macros for pairs and triples **/
106 
107 #ifndef MAX
108 #define MAX(x, y) ((x) >= (y) ? (x) : (y))
109 #endif
110 
111 #ifndef MIN
112 #define MIN(x, y) ((x) <= (y) ? (x) : (y))
113 #endif
114 
115 #define MAX3(x, y, z) MAX((x), MAX((y), (z)))
116 #define MIN3(x, y, z) MIN((x), MIN((y), (z)))
117 
118 #define MAX4(x, y, z, w) MAX(MAX((x), (y)), MAX((z), (w)))
119 #define MIN4(x, y, z, w) MIN(MIN((x), (y)), MIN((z), (w)))
120 
121 /** macros to allow switches over pairs of -small- ints or enums **/
122 
123 #define OPAIR(s1, s2)    (1000*(int) (s1)+(int) (s2))
124 #define PAIR(s1, s2)     MIN(OPAIR(s1, s2), OPAIR(s2, s1))
125 
126 /** between macros **/
127 
128 #define BETWEEN(x,a,b) ( ((x)>(a) && (x)<(b)) || ((x)<(a) && (x)>(b)) )
129 
130 #define OVERLAPPED(a1,a2,b1,b2) ((a2)>=(b1) && (a1)<=(b2))
131 
132 #define TS_ID_BASE 10000
133 typedef enum ts_id
134 {
135     ts_base_id = TS_ID_BASE,
136 
137     Aiffhdr_id,
138     Basis2_id,
139     Basis3_id,
140     Bin_node_id,
141     Blk_stat_id,
142     Camera_id,
143     Circ2_id,
144     Cmap_data_id,
145     Cmap_data_visible_id,
146     Complex_id,
147     Cone_id,
148     Conic_id,
149     Conic3_id,
150     Conic_stat_id,
151     Covar_id,
152     Cursor_data_id,
153     Cvr_slice_id,
154     Cvr_voi_id,
155     Cylinder_id,
156     Ddlist_id,
157     Dpnode_id,
158     Edge_conn_id,
159     Edge_fp_id,
160     Edgel_id,
161     Epos_id,
162     Field_info_id,
163     Font_data_id,
164     Generic_id,
165     Graph_node_id,
166     Icarray_id,
167     Ics2_id,
168     Iffhdr_id,
169     Imrect_id,
170     Imregion_id,
171     Imstack_id,
172     Ipos_id,
173     Iso_error_id,
174     Kwsnake_id,
175     Line2_id,
176     Line3_id,
177     List_id,
178     Mat2_id,
179     Mat3_id,
180     Mat4_id,
181     Match_id,
182     Match_cliche_id,
183     Match_clique_id,
184     Matrix_id,
185     Pair_id,
186     Parcam_id,
187     Pl_axes_id,
188     Pl_ctr_id,
189     Pl_graph_id,
190     Plane_id,
191     Point2_id,
192     Point3_id,
193     Pos2_id,
194     Pos3_id,
195     Prof1_id,
196     Prop_id,
197     Pwrte_gen_id,
198     Pwrte_point_to_point_id,
199     Pwrte_point_to_vec_id,
200     Pwrte_vec_to_vec_id,
201     Quad3_id,
202     Quadric_id,
203     Rgb_id,
204     Rindex_id,
205     Ruled_id,
206     Scalar_id,
207     Snake_id,
208     State_id,
209     String_match_id,
210     Support_id,
211     Terrain_data_id,
212     Tina_color_id,
213     Toptool_data_id,
214     Torus_id,
215     Transf3_id,
216     Transform2_id,
217     Transform3_id,
218     Tree_node_id,
219     Tstring_id,
220     Tv_id,
221     Tv_closest_id,
222     Tv_draw_id,
223     Tv_mask_id,
224     Tv_mouse_id,
225     Tv_patch_id,
226     Tv_pick_id,
227     Tv_picture_id,
228     Tv_screen_id,
229     Tv_zbuff_id,
230     Tw_callback_id,
231     Ucbs_id,
232     Ucbs2_id,
233     Ucbs3_id,
234     Vec2_id,
235     Vec3_id,
236     Vec4_id,
237     Vector_id,
238     Viols_node_id,
239     Vram_id,
240     Windex_id,
241     User_type_0_id,
242     User_type_1_id,
243     User_type_2_id,
244     User_type_3_id,
245     User_type_4_id,
246     User_type_5_id,
247     User_type_6_id,
248     User_type_7_id,
249     User_type_8_id,
250     User_type_9_id,
251     Ts_int_id,
252     Ts_float_id,
253     Ts_double_id,
254     Ts_string_id,
255     ts_last_id
256 }       Ts_id;
257 
258 
259 
260 typedef double Align;   
261 
262 /* blocking managment structure and functions */
263 typedef struct blk_stat         
264   {
265       Ts_id   ts_id;            
266       unsigned int label;
267       struct list *block_list;
268       Align  *block;
269       unsigned int bsize;
270       unsigned int n;
271   }
272 
273 Blk_stat;
274 #define BLK_STAT_SWAP_STRING "up.uu"
275 
276 #ifndef false
277 #define false 0
278 #endif
279 #ifndef true
280 #define true 1
281 #endif
282 
283 /*
284  * prevent conflicts with Bool defs
285  * as in X11/Xlib.h
286  * a.lacey@man.ac.uk : 25.09.02
287  */
288 #ifdef Bool
289 #undef Bool
290 #endif
291 /* xview makes Bool and int */
292 /* typedef char Bool; */
293 typedef int Bool;
294 
295 /* old code ( removed by sam 5.6.97 )
296 typedef enum
297   {
298       false = 0,
299       true = 1
300   } Bool;
301 */  
302 
303 
304 typedef enum
305   {
306       core_dump,
307       fatal,
308       non_fatal,
309       warning
310   } Error;
311 
312 /*
313  * prevent conflicts with other Complex defs
314  * as in X11/X.h
315  * a.lacey@man.ac.uk : 25.09.02
316  */
317 #ifdef Complex
318 #undef Complex
319 #endif
320 
321 typedef struct tcomplex
322   {
323       Ts_id   ts_id;            
324       double   x; 
325       double   y;
326   } Complex;
327 
328 #define COMPLEX_SWAP_STRING "gg" 
329 
330 #define cmplx_re(z) ((z).x)
331 #define cmplx_im(z) ((z).y)
332 
333 typedef struct vram
334   {
335       /* ts id removed by smc 8-2-94 */
336       unsigned char vram0;  /* overlay */
337       unsigned char vram1;  /* blue */
338       unsigned char vram2;  /* green | right */
339       unsigned char vram3;  /* red   | left  */
340   }
341 
342 Vram;
343 #define VRAM_SWAP_STRING "bbbb"
344 
345 #ifdef TINA5
346 /* Ts_id style type identifiers (replace: char_v with Char_id etc
347  * (where char_v is an enum, *not* where char_v is a field name).
348  * #defines VEC - MAT4 are replaced by  */
349 typedef enum
350   {
351       Char_id,                  /* replaces: char_v */
352       Uchar_id,                 /* replaces: uchar_v */
353       Short_id,                 /* replaces: short_v */
354       Ushort_id,                /* replaces: ushort_v */
355       Int_id,                   /* replaces: int_v and INT */
356       Uint_id,                  /* replaces: uint_v */
357       Float_id,                 /* replaces: float_v and FLOAT */
358       Double_id,                /* replaces: double_v and DOUBLE */
359       Ptr_id,                   /* replaces: ptr_v */
360       Vram0_id,                 /* replaces: vram0_v */
361       Vram1_id,                 /* replaces: vram1_v */
362       Vram2_id,                 /* replaces: vram2_v */
363       Vram3_id                  /* replaces: vram3_v */
364 
365       /* Complex_id replaces: complex_v (already defined in tstruct_info.h */
366       /* Ipos_id replaces: IPOS */
367       /* Mat2_id replaces: MAT2 */
368       /* Mat3_id replaces: MAT3 */
369       /* Mat4_id replaces: MAT4 */
370       /* Matrix_id replaces: MATRIX */
371       /* Transform2_id replaces: TRANSFORM2 */
372       /* Transform3_id replaces: TRANSFORM3 */
373       /* Vec2_id replaces: VEC2 */
374       /* Vec3_id replaces: VEC3 */
375       /* Vec4_id replaces: VEC4 */
376       /* Vector_id replaces: VECTOR */
377 
378       /* Ddlist_id replaces: DDLIST */
379       /* Generic_id Replaces: GENERIC */
380       /* Graph_node_id replaces: GRAPH_NODE */
381       /* Imrect_id replaces: IMRECT */
382       /* Imregion_id replaces: REGION */
383       /* List_id replaces: LIST */
384       /* Tstring_id replaces: STRING */
385 
386       /* Imrect_id replaces: IMAGE */
387       /* LOOP NOT replaced */
388       /* Pair_id replaces: PAIRS */
389       /* Prop_type_id replaces: PROP_TYPE */
390       /* Terrain_data_id replaces: TERRAIN */
391   } Ts_id2;
392 typedef Ts_id2 Vartype;
393 
394 #else  /* not TINA5 */
395 typedef enum
396   {
397       char_v,
398       uchar_v,
399       short_v,
400       ushort_v,
401       int_v,
402       uint_v,
403       float_v,
404       double_v,
405       complex_v,
406       ptr_v,
407       vram0_v,
408       vram1_v,
409       vram2_v,
410       vram3_v
411   } Vartype;
412 #endif /* TINA5 */
413 
414 typedef union var
415   {
416       char    char_v;
417       unsigned char uchar_v;
418       short   short_v;
419       unsigned short ushort_v;
420       int     int_v;
421       unsigned int uint_v;
422       float   float_v;
423       double  double_v;
424       struct tcomplex complex_v;
425       void   *ptr_v;
426   }
427 
428 Var;
429 
430 typedef union varptr
431   {
432       char   *char_v;
433       unsigned char *uchar_v;
434       short  *short_v;
435       unsigned short *ushort_v;
436       int    *int_v;
437       unsigned int *uint_v;
438       float  *float_v;
439       double *double_v;
440       struct tcomplex *complex_v;
441       void  **ptr_v;
442   }
443 
444 Varptr;
445 
446 typedef union varptrptr
447   {
448       char  **char_v;
449       unsigned char **uchar_v;
450       short **short_v;
451       unsigned short **ushort_v;
452       int   **int_v;
453       unsigned int **uint_v;
454       float **float_v;
455       double **double_v;
456       struct tcomplex **complex_v;
457       void ***ptr_v;
458       struct vram **vram_v;
459   } Varptrptr;
460 
461 
462 /* define types for standard system structures
463  *
464  * math types are also defined here for the present
465  *
466  * 0 is not used as a type and is universally available
467  *
468  * 1 - 99 are the system types 100 - 199 are math types 200 - 299 are for
469  * tv 300 - 999 are reserved for base 999 - MAXINT are available to the
470  * user */
471 
472 #define POSITIVE 1
473 #define NEGATIVE -1
474 
475 #ifdef TINA5
476 #define PROP_TYPE     1         /* used in property lists */
477 #define STRING        3
478 #define IMAGE         5
479 #define TERRAIN       7
480 #define PAIRS         8
481 
482 #else  /* TINA5 */
483 
484 #define PROP_TYPE     1         /* used in property lists */
485 #define LIST          2
486 #define STRING        3
487 #define DDLIST        4
488 #define IMAGE         5
489 #define IMRECT        5
490 #define REGION        6
491 #define TERRAIN       7
492 #define PAIRS         8
493 #define GRAPH_NODE    9
494 #define GENERIC       10
495 
496 /*
497 #define INT           100
498 #define FLOAT         101
499 #define DOUBLE        102
500 */
501 
502 #define VEC2          120
503 #define VEC3          121
504 /*
505 #define MAT2          122
506 */
507 #define MAT3          123
508 #define TRANSFORM2    124
509 #define TRANSFORM3    125
510 #define MATRIX        126
511 #define VECTOR        127
512 #define IPOS          128
513 #define VEC4          129
514 #define MAT4          130
515 
516 #endif /* TINA5 */
517 
518 #define LOOP          323       /* moved but not renumbered */
519 #define STRING64 64
520 #define STRING128 128
521 
522 
523 
524 /* New types to allow simple items on lists so as to avoid int* in list->to */
525 /* which cannot be serialised  for passing / saving to files etc smc 7/3/94 */
526 
527 typedef struct ts_int
528 {
529     Ts_id ts_id;
530     int i;
531 } Ts_int;
532 #define TS_INT_SWAP_STRING "i"
533 
534 typedef struct ts_float
535 {
536     Ts_id ts_id;
537     float f;
538 } Ts_float;
539 #define TS_FLOAT_SWAP_STRING "f"
540 
541 typedef struct ts_double
542 {
543     Ts_id ts_id;
544     int filler;
545     double d;
546 } Ts_double;
547 #define TS_DOUBLE_SWAP_STRING ",g"
548 
549 typedef struct ts_string
550 {
551     Ts_id ts_id;
552     char s[256];
553 } Ts_string;
554 #define TS_STRING_SWAP_STRING "256c"
555 
556 #endif /* TINA_SYS_GEN_DEF_HDR */
557 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.