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

Linux Cross Reference
Tina5/tina-tools/tinatool/draw/drawPlot_plot.c

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-tools/tinatool/draw/drawPlot_plot.c,v $
 37  * Date    :  $Date: 2003/10/01 16:02:47 $
 38  * Version :  $Revision: 1.2 $
 39  * CVS Id  :  $Id: drawPlot_plot.c,v 1.2 2003/10/01 16:02:47 tony Exp $
 40  *
 41  * Author  : Legacy TINA
 42  *
 43  * Notes :
 44  *
 45  *********
 46 */
 47 
 48 #include "drawPlot_plot.h"
 49 
 50 #if HAVE_CONFIG_H
 51   #include <config.h>
 52 #endif
 53 
 54 #include <stdio.h>
 55 #include <math.h>
 56 
 57 #if HAVE_STDARG_H
 58 #  include <stdarg.h>
 59 #  define VA_START(a, f)    va_start(a, f)
 60 #else
 61 #  if HAVE_VARARGS_H
 62 #    include <varargs.h>
 63 #    define VA_START(a, f)  va_start(a)
 64 #  endif
 65 #endif /* HAVE_STDARG_H */
 66 #ifndef VA_START
 67   error no variadic api available
 68 #endif
 69 
 70 #include <tina/sys/sysDef.h>
 71 #include <tina/sys/sysPro.h>
 72 #include <tina/math/mathDef.h>
 73 #include <tina/geometry/geomDef.h>
 74 #include <tinatool/draw/draw_TvDef.h>
 75 #include <tinatool/draw/draw_PlotDef.h>
 76 #include <tinatool/draw/draw_PlotPro.h>
 77 
 78 void
 79 #if HAVE_STDARG_H
 80 plot(int case_flag, ...)
 81 #else
 82 plot(case_flag, va_alist)
 83         int case_flag;
 84         va_dcl
 85 #endif /* HAVE_STDARG_H */
 86 {
 87     va_list ap;
 88     VA_START(ap, case_flag);
 89 
 90     while (case_flag)
 91     {
 92         switch (case_flag)
 93         {
 94             case PL_INIT:
 95                 pl_init();
 96                 break;
 97             case PL_FREE:
 98             {
 99                 Bool set = (Bool) va_arg(ap, int);
100                 pl_free_set(set);
101                 break;
102             }
103             case PL_TV:
104             {
105                 Tv *tv = (Tv *) va_arg(ap, void *);
106                 pl_set_tv(tv);
107                 break;
108             }
109             case PL_COLOR:
110             {
111                 int color = va_arg(ap, int);
112                 pl_set_color(color);
113                 break;
114             }
115             case PL_AXIS_COLOR:
116             {
117                 int color = va_arg(ap, int);
118                 pl_set_axis_color(color);
119                 break;
120             }
121             case PL_STYLE:
122             {
123                 int style = va_arg(ap, int);
124                 pl_set_style(style);
125                 break;
126             }
127             case PL_TITLE:
128             {
129                 char *title = va_arg(ap, char *);
130                 pl_set_title(title);
131                 break;
132             }
133             case PL_LEGEND:
134             {
135                 char *legend = va_arg(ap, char *);
136                 pl_set_legend(legend);
137                 break;
138             }
139             case PL_AXES:
140             {
141                 Bool set = (Bool) va_arg(ap, int);
142                 pl_set_x_axis(set);
143                 pl_set_y_axis(set);
144             }
145             break;
146             case PL_TICS:
147             {
148                 Bool set = (Bool) va_arg(ap, int);
149                 pl_set_x_tics(set);
150                 pl_set_y_tics(set);
151                 break;
152             }
153             case PL_TEXT:
154             {
155                 Bool set = (Bool) va_arg(ap, int);
156                 pl_set_x_text(set);
157                 pl_set_y_text(set);
158                 break;
159             }
160             case PL_X_AXIS:
161             {
162                 Bool set = (Bool) va_arg(ap, int);
163                 pl_set_x_axis(set);
164                 break;
165             }
166             case PL_X_TICS:
167             {
168                 Bool set = (Bool) va_arg(ap, int);
169                 pl_set_x_tics(set);
170                 break;
171             }
172             case PL_X_TEXT:
173             {
174                 Bool set = (Bool) va_arg(ap, int);
175                 pl_set_x_text(set);
176                 break;
177             }
178             case PL_X_RANGE:
179             {
180                 double xmin = va_arg(ap, double);
181                 double xmax = va_arg(ap, double);
182                 double xinc = va_arg(ap, double);
183                 pl_set_x_range(xmin, xmax, xinc);
184                 break;
185             }
186             case PL_Y_AXIS:
187             {
188                 Bool set = (Bool) va_arg(ap, int);
189                 pl_set_y_axis(set);
190                 break;
191             }
192             case PL_Y_TICS:
193             {
194                 Bool set = (Bool) va_arg(ap, int);
195                 pl_set_y_tics(set);
196                 break;
197             }
198             case PL_Y_TEXT:
199             {
200                 Bool set = (Bool) va_arg(ap, int);
201                 pl_set_y_text(set);
202                 break;
203             }
204             case PL_Y_RANGE:
205             {
206                 double ymin = va_arg(ap, double);
207                 double ymax = va_arg(ap, double);
208                 double yinc = va_arg(ap, double);
209                 pl_set_y_range(ymin, ymax, yinc);
210                 break;
211             }
212             case PL_XFORMAT:
213             {
214                 char *fmt = va_arg(ap, char *);
215                 pl_xfmt_set(fmt);
216                 break;
217             }
218             case PL_YFORMAT:
219             {
220                 char *fmt = va_arg(ap, char *);
221                 pl_yfmt_set(fmt);
222                 break;
223             }
224             case PL_GRAPH_DATA:
225             {
226                 int n;
227                 float *x, *y;
228                 n = va_arg(ap, int);
229                 x = (float *) va_arg(ap, void *);
230                 y = (float *) va_arg(ap, void *);
231                 pl_set_graph_data(n, x, y);
232                 break;
233             }
234             case PL_SCATTER_DATA:
235             {
236                 int n = va_arg(ap, int);
237                 float *x = (float *) va_arg(ap, void *);
238                 float *y = (float *) va_arg(ap, void *);
239                 pl_set_scatt_data(n, x, y);
240                 break;
241             }
242             case PL_GRAPH_FUNC:
243             {
244                 int n = va_arg(ap, int);
245                 double a = va_arg(ap, double);
246                 double b = va_arg(ap, double);
247                 double (*f) () = (double (*) ()) va_arg(ap, void *);
248                 pl_set_graph_func(n, a, b, f);
249                 break;
250             }
251             case PL_HIST_RANGE:
252             {
253                 double zmin = va_arg(ap, double);
254                 double zmax = va_arg(ap, double);
255                 double zinc = va_arg(ap, double);
256                 pl_set_hist_range(zmin, zmax, zinc);
257                 break;
258             }
259             case PL_HIST_DATA:
260             {
261                 int n = va_arg(ap, int);
262                 float *z = (float *) va_arg(ap, void *);
263                 pl_set_hist_data(n, z);
264                 break;
265             }
266             case PL_HIST:
267             {
268                 void *h = va_arg(ap, void *);
269                 pl_set_hist_binned_data(h);
270                 break;
271             }
272             case PL_CUMHIST_DATA:
273             {
274                 int n = va_arg(ap, int);
275                 float *z = (float *) va_arg(ap, void *);
276                 pl_set_cumhist_data(n, z);
277                 break;
278             }
279             case PL_CTR_RANGE:
280             {
281                 double cmin = va_arg(ap, double);
282                 double cmax = va_arg(ap, double);
283                 double cinc = va_arg(ap, double);
284                 pl_set_ctr_range(cmin, cmax, cinc);
285                 break;
286             }
287             case PL_CTR_DATA:
288             {
289                 int nx = va_arg(ap, int);
290                 float *x = (float *) va_arg(ap, void *);
291                 int ny = va_arg(ap, int);
292                 float *y = (float *) va_arg(ap, void *);
293                 float **z = (float **) va_arg(ap, void *);
294                 pl_set_ctr_data(nx, x, ny, y, z);
295                 break;
296             }
297             case PL_CTR_FUNC:
298             {
299                 int nx = va_arg(ap, int);
300                 double ax = va_arg(ap, double);
301                 double bx = va_arg(ap, double);
302                 int ny = va_arg(ap, int);
303                 double ay = va_arg(ap, double);
304                 double by = va_arg(ap, double);
305                 double (*f) () = (double (*) ()) va_arg(ap, void *);
306                 pl_set_ctr_func(nx, ax, bx, ny, ay, by, f);
307                 break;
308             }
309             case PL_PLOT:
310                 pl_plot();
311                 break;
312         }
313         case_flag = va_arg(ap, int);
314     }
315     va_end(ap);
316 }
317 

~ [ 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.