Changeset 420 for trunk/Jgraph/draw.c


Ignore:
Timestamp:
02/27/08 07:13:31 (16 years ago)
Author:
Nicholas Riley
Message:

Jgraph: my changes - ANSIfication, few minor bug fixes; works on OS X 10.5 now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Jgraph/draw.c

    r419 r420  
    2222      error_header();
    2323      fprintf(stderr,
    24               "Value of %f is at negative infinity with logrhythmic %c axis\n",
     24              "Value of %f is at negative infinity with logarithmic %c axis\n",
    2525              val, (axis->is_x) ? 'x' : 'y');
    26        exit(1);
     26      exit(1);
    2727    }
    2828    return (log(val) / axis->logfactor - axis->logmin) * axis->factor;
     
    5151#define MAXIMUM(a,b) ((a > b) ? a : b)
    5252
    53 draw_axis(a, other)
    54 Axis a, other;
     53void draw_label(Label l)
     54{
     55  if (l->label == CNULL) return;
     56  comment(l->label);
     57  print_label(l);
     58}
     59
     60void draw_axis(Axis a, Axis other)
    5561{
    5662  char orientation;
     
    117123
    118124
    119 draw_label(l)
    120 Label l;
    121 {
    122   if (l->label == CNULL) return;
    123   comment(l->label);
    124   print_label(l);
    125 }
    126 
    127 set_clip(g)
    128 Graph g;
     125void set_clip(Graph g)
    129126{
    130127  comment("Setting Clip");
     
    136133}
    137134
    138 draw_curves(g)
    139 Graph g;
     135void draw_curve(Curve c, Graph g);
     136
     137void draw_curves(Graph g)
    140138{
    141139  Curve c;
     
    151149}
    152150
    153 draw_curve(c, g)
    154 Curve c;
    155 Graph g;
     151void draw_mark(float x, float y, Curve c, Graph g);
     152void draw_arrow(float x1, float y1, float x2, float y2, Curve c);
     153
     154void draw_curve(Curve c, Graph g)
    156155{
    157156  Point p, px, py;
     
    270269}
    271270
    272 draw_mark(x, y, c, g)
    273 float x, y;
    274 Curve c;
    275 Graph g;
     271void draw_mark(float x, float y, Curve c, Graph g)
    276272{
    277273  Point p;
     
    317313              }
    318314              for (i = 0; i < 4; i++) {
    319                 if (fscanf(f, "%d", &(bb[i])) == NULL) {
     315                if (fscanf(f, "%d", &(bb[i])) == 0) {
    320316                  fprintf(stderr, "Error: Eps file '%s': eof in %s\n",
    321317                          c->eps, "bounding box");
     
    502498}
    503499
    504 draw_arrow(x1, y1, x2, y2, c)
    505 float x1, y1, x2, y2;
    506 Curve c;
     500void draw_arrow(float x1, float y1, float x2, float y2, Curve c)
    507501{
    508502  float dx, dy;
     
    542536}
    543537
    544 draw_legend(g)
    545 Graph g;
     538void draw_legend(Graph g)
    546539{
    547540  Curve c;
     
    606599}
    607600
    608 draw_strings(g)
    609 Graph g;
     601void draw_strings(Graph g)
    610602{
    611603  String s;
     
    616608}
    617609
    618 draw_graph(g)
    619 Graph g;
     610void draw_graph(Graph g)
    620611{
    621612  comment("Drawing New Graph");
     
    637628}
    638629
    639 draw_graphs(gs, pp, landscape)
    640 Graphs gs;
    641 int pp;
    642 int landscape;
     630void draw_header(Graphs gs, int pp, int landscape);
     631void draw_footer(Graphs gs, int pp);
     632
     633void draw_graphs(Graphs gs, int pp, int landscape)
    643634{
    644635  Graphs gs_p;
     
    661652}
    662653
    663 draw_header(gs, pp, landscape)
    664 Graphs gs;
    665 int pp;
    666 int landscape;
     654void draw_header(Graphs gs, int pp, int landscape)
    667655{
    668656  FILE *f;
     
    774762    }
    775763  } else if (landscape) {
    776     printf("%f 0 translate\n", -gs->bb[2] - gs->bb[0]);
     764    printf("%d 0 translate\n", -gs->bb[2] - gs->bb[0]);
    777765  }
    778766  printf("1 setlinecap 1 setlinejoin\n");
     
    835823}
    836824
    837 draw_footer(gs, pp)
    838 Graphs gs;
    839 int pp;
     825void draw_footer(Graphs gs, int pp)
    840826{
    841827  FILE *f;
Note: See TracChangeset for help on using the changeset viewer.