home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / gle / gle / graph.h < prev    next >
C/C++ Source or Header  |  1992-11-29  |  4KB  |  168 lines

  1. #include "all.h"
  2. #include "axis.h"
  3. #include "mygraph.h"
  4. #include <math.h>
  5.  
  6. #ifdef VAXC         /* because it won't fit on the PC */
  7. #define HERROR 1        /* because it won't fit on the PC */
  8. #endif
  9. #define HERROR 1 /* only uses about 2k more */
  10.  
  11. #define BEGINDEF extern
  12. #include "begin.h"
  13.  
  14. /* for key command and gx(), gy() */
  15.  
  16. #define dbg if ((gle_debug & 64)>0)
  17. #define LARGE_NUM 1E30
  18. extern int gle_debug;
  19.  
  20. int graph_init(void);
  21. int graph_free(void);
  22. int iffree(void *p,char *s);
  23. int setrange(double x, double y, int m);
  24. int gdraw_key(double koffsetx, double koffsety, char *kpos, double khei, int knobox);
  25. int copy_default(int d);
  26. int do_dataset(int d);
  27. int draw_errbar(double x, double y, double eup, double ewid);
  28. int fill_vec(double x1, double y1, double x2, double y2);
  29. int do_smooth(void);
  30. int window_set(void);
  31. int draw_bars(void);
  32. int draw_lines(void);
  33. int draw_fills(void);
  34. int draw_err(void);
  35. int do_let(char *s);
  36. int request(void);
  37. int draw_axis(void *axis);
  38. int draw_bar(double x, double yf, double yt, double wd,double x3d,double y3d,long sidecolor, long topcolor, int notop);
  39. int doskip(char *s,int *ct);
  40. double get_next_exp(TOKENS tk,int *ntk,int *curtok);
  41.  
  42. /* #define fnx(vv)  (((vv-wxmin)/(wxmax-wxmin)) * xlength + xbl) */
  43. /* #define fny(vv)  (((vv-wymin)/(wymax-wymin)) * ylength + ybl) */
  44. #define kw(ss) if (strcmp(tk[ct],ss)==0)
  45. #define true (!false)
  46. #define false 0
  47.  
  48. int var_find_dn(int *idx, int *vara, int *nd);
  49. char *un_quote(char *ct);
  50.  
  51. #define skipspace doskip(tk[ct],&ct)
  52. #define tok(n)  (*tk)[n]
  53. #define next_exp (get_next_exp((TOKENS) tk,&ntk,&ct))
  54. #define next_font ((ct+=1),pass_font(tk[ct]))
  55. #define next_marker ((ct+=1),pass_marker(tk[ct]))
  56. #define next_color ((ct+=1),pass_color(tk[ct]))
  57. #define next_fill ((ct+=1),pass_color(tk[ct]))
  58. #define next_str(s)  (ct+=1,skipspace,strcpy(s,tk[ct]))
  59. #define next_vstr(s)  (ct+=1,skipspace,mystrcpy(&s,tk[ct]))
  60. #define next_vquote(s) (ct+=1,skipspace,mystrcpy(&s,un_quote(tk[ct])))
  61. #define next_quote(s) (ct+=1,skipspace,strcpy(s,un_quote(tk[ct])))
  62. #define ifer if (erflg)
  63.  
  64. extern long *(*gpcode)[];   /* gpcode is a pointer to an array of poiter to long */
  65. extern long (*gplen)[];   /* gpcode is a pointer to an array of long */
  66. extern int ngpcode;
  67.  
  68. struct fill_data {
  69.     int da,db;    /* fill from, too */
  70.     int type;     /* 1= x1,d1, 2=d1,x2, 3=d1,d2, 4=d1 */
  71.     long color;
  72.     double xmin,ymin,xmax,ymax;
  73. };
  74. struct data_struct {
  75.     double *xv;    /* from zero */
  76.     double *yv;
  77.     int *miss;
  78.     int nomiss;
  79.     int np,autoscale;
  80.     char lstyle[9];
  81.     char *bigfile;    /* for datasets too big for memory */
  82.     char *key_name;
  83.     long key_fill;
  84.     char errup[9],errdown[9];
  85.     double errwidth;
  86. #ifdef HERROR         /* because it won't fit on the PC */
  87.     char herrup[9],herrdown[9];
  88.     double herrwidth;
  89. #endif
  90.     double msize,lwidth;
  91.     int marker, smooth, smoothm;
  92.     int mdata;
  93.     long color;
  94.     double scale_ax, scale_bx, scale_ay, scale_by;
  95.     double xmin,ymin,xmax,ymax;
  96.     double mscale;
  97.     int line;
  98.     double rx1,ry1,rx2,ry2;
  99. };
  100. struct bar_struct {
  101.     int ngrp;
  102.     int from[20];
  103.     int to[20];
  104.     double width,dist;
  105.     double lwidth[20];
  106.     char lstyle[20][9];
  107.     long fill[20];
  108.     long color[20];
  109.     long side[20];
  110.     long top[20];
  111.     int notop;
  112.     double x3d,y3d;
  113. };
  114.  
  115. #ifdef __TURBOC__
  116. #define MAXTEMP 2000
  117. #else
  118. #define MAXTEMP 10000
  119. #endif
  120.  
  121. #ifdef GRAPHDEF
  122. #else
  123. #define GRAPHDEF
  124. #endif
  125.  
  126. GRAPHDEF double range_x1,range_y1,range_x2,range_y2;  /* graph unist */
  127. GRAPHDEF double graph_x1,graph_y1,graph_x2,graph_y2;  /* in cm */
  128. GRAPHDEF double graph_xmin,graph_ymin,graph_xmax,graph_ymax; /* graph units */
  129. GRAPHDEF double *tmpf;  /* [MAXTEMP+10]; */
  130. GRAPHDEF int *tmpmiss; /*  [MAXTEMP+10]; */
  131. GRAPHDEF int ntmp_alloc; /*  [MAXTEMP+10]; */
  132. GRAPHDEF char ebuff[400];
  133. GRAPHDEF int etype,eplen;
  134. GRAPHDEF double wxmin,wymin,wxmax,wymax; /* in axis units the bounds of the graph */
  135. GRAPHDEF double xbl,ybl;
  136. GRAPHDEF double xlength,ylength;
  137. GRAPHDEF double g_xsize,g_ysize,g_hscale,g_vscale,g_fontsz;
  138. GRAPHDEF double last_vecx,last_vecy;
  139. GRAPHDEF int ndata,g_nobox,done_line;
  140. GRAPHDEF double sizex,sizey;
  141. GRAPHDEF double vscale,hscale;
  142.  
  143. GRAPHDEF struct fill_data *fd[20];
  144. GRAPHDEF int nfd;
  145. GRAPHDEF int gntmp;
  146.  
  147. GRAPHDEF struct data_struct *dp[101];
  148. GRAPHDEF struct data_struct *dpp;
  149.  
  150. GRAPHDEF int g_nbar;
  151. GRAPHDEF struct bar_struct *br[20];
  152. GRAPHDEF struct axis_struct xx[5];
  153. int vinit_axis(int i);
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.