Ticket #36397: patch-printline.c.diff

File patch-printline.c.diff, 4.4 KB (added by stevecheckoway (Stephen Checkoway), 12 years ago)
  • printline.c

    old new  
    77
    88#include "jgraph.h"
    99#include <stdio.h>
     10#include <string.h>
    1011
    1112#define LINEWIDTHFACTOR 0.700
    1213#define MAX(a, b) ((a > b) ? (a) : (b))
    static Fontlist Jgraph_fonts; 
    2324static int Jgraph_gsave_level = -100;
    2425static int Jgraph_comment;
    2526
    26 gsave()
     27void gsave()
    2728{
    2829  if (Jgraph_gsave_level == -100) {
    2930    Jgraph_gsave_level = 0;
    gsave() 
    3334  printf(" gsave ");
    3435}
    3536
    36 grestore()
     37void grestore()
    3738{
    3839  Fontlist l;
    3940
    grestore() 
    4849  printf(" grestore ");
    4950}
    5051
    51 setfont(f, s)
    52 char *f;
    53 float s;
     52void setfont(char *f, float s)
    5453{
    5554  Fontlist l;
    5655  int ins;
    float s; 
    7574  }
    7675}
    7776 
    78 setfill( x, y, t, f, p, a)
    79 char t, p ;
    80 float x, y;
    81 float f[], a ;
     77void setfill(float x, float y, char t, float *f, char p, float a)
    8278{
    8379/*   fprintf(stderr, "Hello?  %c %f %c %f\n", t, f[0], p, a); */
    8480  if (t == 'g' && f[0] < 0.0) return;
    float f[], a ; 
    10096  printf(" grestore\n");
    10197}
    10298
    103 setgray( t, f)
    104 char t ;
    105 float f[] ;
     99void setgray(char t, float *f)
    106100{
    107101    if ( t == 'g' )  {
    108102       if( f[0] >= 0.0 ) printf("%f setgray\n", f[0] );
    float f[] ; 
    111105    }
    112106}
    113107
    114 printline(x1, y1,x2, y2, orientation)
    115 float x1, y1, x2, y2;
    116 char orientation;
     108void printline(float x1, float y1, float x2, float y2, char orientation)
    117109{
    118110  if (orientation == 'x')
    119111    printf("newpath %f %f moveto %f %f lineto stroke\n", x1, y1, x2, y2);
    char orientation; 
    122114  fflush(stdout);
    123115}
    124116
    125 print_ebar(x1, y1, x2, ms, orientation)
    126 float x1, y1, x2, ms;
    127 char orientation;
     117void print_ebar(float x1, float y1, float x2, float ms, char orientation)
    128118{
    129119  printline(x1, y1, x2, y1, orientation);
    130120  printline(x2, y1-ms, x2, y1+ms, orientation);
    131121}
    132122
    133 start_line(x1, y1, c)
    134 float x1, y1;
    135 Curve c;
     123void start_line(float x1, float y1, Curve c)
    136124{
    137125  setlinewidth(c->linethick);
    138126  setlinestyle(c->linetype, c->gen_linetype);
    139127  printf("%f %f moveto ", x1, y1);
    140128}
    141129
    142 cont_line(x1, y1)
    143 float x1, y1;
     130void cont_line(float x1, float y1)
    144131{
    145132  printf("  %f %f lineto\n", x1, y1);
    146133}
    147134
    148 end_line()
     135void end_line()
    149136{
    150137  printf("stroke\n");
    151138  setlinewidth(1.0);
    end_line() 
    154141
    155142}
    156143
    157 bezier_control(x1, y1)
    158 float x1, y1;
     144void bezier_control(float x1, float y1)
    159145{
    160146  printf("  %f %f ", x1, y1);
    161147}
    162148
    163 bezier_end(x1, y1)
    164 float x1, y1;
     149void bezier_end(float x1, float y1)
    165150{
    166151  printf("  %f %f curveto\n", x1, y1);
    167152}
    168153
    169154
    170 start_poly(x1, y1)
    171 float x1, y1;
     155void start_poly(float x1, float y1)
    172156{
    173157  printf(" newpath %f %f moveto", x1, y1);
    174158}
    175159
    176 cont_poly(x1, y1)
    177 float x1, y1;
     160void cont_poly(float x1, float y1)
    178161{
    179162  printf("  %f %f lineto\n", x1, y1);
    180163}
    181164
    182 end_poly(x, y, ftype, fill, pattern, parg)
    183 float x, y;
    184 char  ftype, pattern ;
    185 float fill[], parg;
     165void end_poly(float x, float y, char ftype, float *fill, char pattern, float parg)
    186166{
    187167  printf("closepath ");
    188168  setfill( x, y, ftype, fill, pattern, parg );
    float fill[], parg; 
    192172
    193173/* Ellipse at 0, 0 -- assumes that you've already translated to x, y */
    194174
    195 printellipse(x, y, radius1, radius2, ftype, fill, pattern, parg)
    196 char ftype, pattern;
    197 float x, y, radius1, radius2, fill[], parg;
     175void printellipse(float x, float y, float radius1, float radius2, char ftype, float *fill, char pattern, float parg)
    198176{
    199177  printf("newpath %f %f JDE\n", radius1, radius2);
    200178  setfill( x, y, ftype, fill, pattern, parg );
    float x, y, radius1, radius2, fill[], pa 
    202180  fflush(stdout);
    203181}
    204182
    205 set_comment(c)
    206 int c;
     183void set_comment(int c)
    207184{
    208185  Jgraph_comment = c;
    209186}
    210187
    211 comment(s)
    212 char *s;
     188void comment(const char *s)
    213189{
    214190  if (Jgraph_comment) printf("%% %s\n", s);
    215191}
    216192
    217 printline_c(x1, y1, x2, y2, g)
    218 float x1, y1, x2, y2;
    219 Graph g;
     193#if 0
     194static void printline_c(float x1, float y1, float x2, float y2, Graph g)
    220195{
    221196  printline(ctop(x1, g->x_axis), ctop(y1, g->y_axis),
    222197            ctop(x2, g->x_axis), ctop(y2, g->y_axis), 'x');
    223198}
     199#endif
    224200
    225 print_label(l)
    226 Label l;
     201void print_label(Label l)
    227202{
    228203  int f, i, nlines;
    229204  float fnl;
    Label l; 
    290265  printf("grestore\n");
    291266}
    292267
    293 setlinewidth(size)
    294 float size;
     268void setlinewidth(float size)
    295269{
    296270  printf("%f setlinewidth ", size * LINEWIDTHFACTOR);
    297271}
    298272
    299 setlinestyle(style, glist)
    300 char style;
    301 Flist glist;
     273void setlinestyle(char style, Flist glist)
    302274{
    303275  Flist fl;
    304276