Broad front of work in progress:
[xiph/unicode.git] / sushivision / sushivision.h
bloba12e832898d99fd300469941a78f879ff40a8a4e
1 /*
3 * sushivision copyright (C) 2006-2007 Monty <monty@xiph.org>
5 * sushivision is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * sushivision is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with sushivision; see the file COPYING. If not, write to the
17 * Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22 #ifndef _SUSHIVISION_
23 #define _SUSHIVISION_
25 typedef struct sv_scale sv_scale_t;
26 typedef struct sv_panel sv_panel_t;
27 typedef struct sv_dim sv_dim_t;
28 typedef struct _sv_obj sv_obj_t;
29 typedef struct _sv_scale_internal sv_scale_internal_t;
30 typedef struct _sv_dim_internal sv_dim_internal_t;
31 typedef union _sv_dim_subtype sv_dim_subtype_t;
32 typedef struct _sv_panel_internal sv_panel_internal_t;
33 typedef union _sv_panel_subtype sv_panel_subtype_t;
35 int sv_submain(int argc, char *argv[]);
36 int sv_atexit(void);
37 int sv_save(char *filename);
38 int sv_load(char *filename);
40 /* toplevel ******************************************************/
41 extern int sv_init(void);
42 extern int sv_go(void);
43 extern int sv_join(void);
45 /* scales ********************************************************/
47 struct sv_scale{
48 int vals;
49 double *val_list;
50 char **label_list;
51 char *legend;
53 sv_scale_internal_t *private;
54 unsigned flags;
57 sv_scale_t *sv_scale_new (char *name,
58 char *values);
60 sv_scale_t *sv_scale_copy (sv_scale_t *s);
62 void sv_scale_free (sv_scale_t *s);
64 /* dimensions ****************************************************/
66 #define SV_DIM_NO_X 0x100
67 #define SV_DIM_NO_Y 0x200
68 #define SV_DIM_ZEROINDEX 0x1
69 #define SV_DIM_MONOTONIC 0x2
71 enum sv_dim_type { SV_DIM_CONTINUOUS,
72 SV_DIM_DISCRETE,
73 SV_DIM_PICKLIST};
75 struct sv_dim{
76 int number;
77 char *name;
78 char *legend;
79 enum sv_dim_type type;
81 double bracket[2];
82 double val;
84 sv_scale_t *scale;
85 unsigned flags;
87 int (*callback)(sv_dim_t *);
88 sv_dim_subtype_t *subtype;
89 sv_dim_internal_t *private;
92 sv_dim_t *sv_dim_new (char *decl);
94 sv_dim_t *sv_dim (char *name);
96 int sv_dim_set_scale (sv_scale_t *scale);
98 int sv_dim_make_scale (char *format);
100 int sv_dim_set_value (double val);
102 int sv_dim_set_bracket (double lo,
103 double hi);
105 int sv_dim_callback_value (int (*callback)(sv_dim_t *, void*),
106 void *callback_data);
108 /* objectives ****************************************************/
110 int sv_obj_new (char *decl,
111 void (*function)(double *,double *),
112 char *input_map,
113 char *output_map);
115 int sv_obj (char *name);
117 int sv_obj_set_scale (sv_scale_t *scale);
119 int sv_obj_make_scale (char *format);
121 /* panels ********************************************************/
123 enum sv_panel_type { SV_PANEL_1D,
124 SV_PANEL_2D,
125 SV_PANEL_XY };
126 enum sv_background { SV_BG_WHITE,
127 SV_BG_BLACK,
128 SV_BG_CHECKS };
130 #define SV_PANEL_FLIP 0x4
132 typedef struct {
133 sv_dim_t *d;
134 sv_panel_t *p;
135 } sv_dim_list_t;
137 typedef struct {
138 sv_obj_t *o;
139 sv_panel_t *p;
140 } sv_obj_list_t;
142 struct sv_panel {
143 int number;
144 char *name;
145 enum sv_panel_type type;
147 int dimensions;
148 sv_dim_list_t *dimension_list;
149 int objectives;
150 sv_obj_list_t *objective_list;
152 unsigned flags;
154 sv_panel_subtype_t *subtype;
155 sv_panel_internal_t *private;
158 sv_panel_t *sv_panel_new_1d (int number,
159 char *name,
160 sv_scale_t *y_scale,
161 char *objectives,
162 char *dimensions,
163 unsigned flags);
165 sv_panel_t *sv_panel_new_xy (int number,
166 char *name,
167 sv_scale_t *x_scale,
168 sv_scale_t *y_scale,
169 char *objectives,
170 char *dimensions,
171 unsigned flags);
173 sv_panel_t *sv_panel_new_2d (int number,
174 char *name,
175 char *objectives,
176 char *dimensions,
177 unsigned flags);
179 int sv_panel_callback_recompute (sv_panel_t *p,
180 int (*callback)(sv_panel_t *p,void *data),
181 void *data);
183 int sv_panel_set_resample (sv_panel_t *p,
184 int numerator,
185 int denominator);
187 int sv_panel_set_background (sv_panel_t *p,
188 enum sv_background bg);
190 int sv_panel_set_axis (sv_panel_t *p,
191 char axis,
192 sv_dim_t *d);
194 int sv_panel_get_resample (sv_panel_t *p,
195 int *numerator,
196 int *denominator);
198 int sv_panel_get_background (sv_panel_t *p,
199 enum sv_background *bg);
201 sv_dim_t *sv_panel_get_axis (sv_panel_t *p, char axis);
204 #endif