1 /* output.h: interface for output handlers
2 
3    Copyright (C) 1999, 2000, 2001, 2002 Bernhard Herzog.
4 
5    This library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public License
7    as published by the Free Software Foundation; either version 2.1 of
8    the License, or (at your option) any later version.
9 
10    This library is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with this library; if not, write to the Free Software
17    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18    USA. */
19 
20 #ifndef OUTPUT_H
21 #define OUTPUT_H
22 #include <stdio.h>
23 #include "autotrace.h"
24 #include "types.h"
25 #include "exception.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif /* __cplusplus */
30 
31 /* Data struct hierarchy:
32    spline_list_array (splines)
33    -> spline_list...
34    --> spline */
35 
36 /* Accessors to the Data member  */
37 #define AT_SPLINE_START_POINT_VALUE(spl)      ((spl).v[0])
38 #define AT_SPLINE_CONTROL1_VALUE(spl)	      ((spl).v[1])
39 #define AT_SPLINE_CONTROL2_VALUE(spl)         ((spl).v[2])
40 #define AT_SPLINE_END_POINT_VALUE(spl)        ((spl).v[3])
41 #define AT_SPLINE_DEGREE_VALUE(spl)           ((spl).degree)
42 
43 #define AT_SPLINE_START_POINT(spl)            (&AT_SPLINE_START_POINT_VALUE(*(spl)))
44 #define AT_SPLINE_CONTROL1(spl)	              (&AT_SPLINE_CONTROL1_VALUE(*(spl)))
45 #define AT_SPLINE_CONTROL2(spl)               (&AT_SPLINE_CONTROL2_VALUE(*(spl)))
46 #define AT_SPLINE_END_POINT(spl)              (&AT_SPLINE_END_POINT_VALUE(*(spl)))
47 #define AT_SPLINE_DEGREE(spl)	              AT_SPLINE_DEGREE_VALUE(*(spl))
48 
49 #define AT_SPLINE_LIST_LENGTH_VALUE(spll)     ((spll).length)
50 #define AT_SPLINE_LIST_LENGTH(spll)           AT_SPLINE_LIST_LENGTH_VALUE(*(spll))
51 #define AT_SPLINE_LIST_DATA_VALUE(spll)       ((spll).data)
52 #define AT_SPLINE_LIST_DATA(spll)             AT_SPLINE_LIST_DATA_VALUE((*spll))
53 #define AT_SPLINE_LIST_ELT_VALUE(spll,index)  AT_SPLINE_LIST_DATA_VALUE(spll)[(index)]
54 #define AT_SPLINE_LIST_ELT(spll,index)        (&(AT_SPLINE_LIST_ELT_VALUE((*spll), (index))))
55 #define AT_SPLINE_LIST_COLOR_VALUE(spll)      ((spll).color)
56 #define AT_SPLINE_LIST_COLOR(spll)            (&(AT_SPLINE_LIST_COLOR_VALUE(*spll)))
57 #define AT_SPLINE_LIST_IS_OPENED_VALUE(spll)  ((spll).open)
58 #define AT_SPLINE_LIST_IS_OPENED(spll)        AT_SPLINE_LIST_IS_OPENED_VALUE(*(spll))
59 
60 #define AT_SPLINE_LIST_ARRAY_LENGTH_VALUE     AT_SPLINE_LIST_LENGTH_VALUE
61 #define AT_SPLINE_LIST_ARRAY_LENGTH           AT_SPLINE_LIST_LENGTH
62 #define AT_SPLINE_LIST_ARRAY_ELT_VALUE        AT_SPLINE_LIST_ELT_VALUE
63 #define AT_SPLINE_LIST_ARRAY_ELT              AT_SPLINE_LIST_ELT
64 
65 #define AT_SPLINE_LIST_ARRAY_IS_CENTERLINE_VALUE(splla) ((splla).centerline)
66 #define AT_SPLINE_LIST_ARRAY_IS_CENTERLINE(splla)       AT_SPLINE_LIST_ARRAY_IS_CENTERLINE_VALUE(*(splla))
67 
68 /*
69  * Glib style traversing
70  */
71 
72 typedef void (* AtSplineListForeachFunc) (at_spline_list_type * spline_list,
73 					     at_spline_type * spline,
74 					     int index,
75 					     at_address user_data);
76 typedef void (* AtSplineListArrayForeachFunc) (at_spline_list_array_type * spline_list_array,
77 						  at_spline_list_type * spline_list,
78 						  int index,
79 						  at_address user_data);
80 
81 void at_spline_list_foreach (at_spline_list_type *,
82 			     AtSplineListForeachFunc func,
83 			     at_address user_data);
84 void at_spline_list_array_foreach (at_spline_list_array_type *,
85 				   AtSplineListArrayForeachFunc func,
86 				   at_address user_data);
87 
88 int   at_output_add_handler (at_string suffix,
89 			     at_string description,
90 			     at_output_write_func func);
91 
92 #ifdef __cplusplus
93 }
94 #endif /* __cplusplus */
95 
96 #endif /* not OUTPUT_H */
97