home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume28 / jgraph / patch07.3 < prev    next >
Text File  |  1992-02-09  |  35KB  |  1,360 lines

  1. Newsgroups: comp.sources.misc
  2. From: jsp@Princeton.EDU (James Plank)
  3. Subject:  v28i017:  jgraph - A filter for plotting postscript graphs, Patch07.3
  4. Message-ID: <1992Feb6.231730.23678@sparky.imd.sterling.com>
  5. X-Md4-Signature: b6faf725c76ba472ab0a62011f9e5978
  6. Date: Thu, 6 Feb 1992 23:17:30 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: jsp@Princeton.EDU (James Plank)
  10. Posting-number: Volume 28, Issue 17
  11. Archive-name: jgraph/patch07.3
  12. Environment: UNIX, VMS, postscript
  13. Patch-To: jgraph: Volume 16, Issue 20
  14.  
  15. Jgraph Patch 7.3: Tue Feb  4 12:30:45 EST 1992
  16.  
  17. Sorry again to be sending out another patch so soon, but there was a
  18. bug which needed immediate attention, so I put in some more junk that
  19. people have been asking for:
  20.  
  21. - Fixed yet another bug in bounding box calculation.  I don't think
  22.   this one affected too many graphs, but still its a bug.  Thanks to
  23.   Ryoichi Hajima for pointing this out.
  24.  
  25. - Strings are now included in bounding box calculations.
  26.  
  27. - Added a few performance enhancements suggested by Dave Wortman:
  28.   Comments are no longer included in the postscript output unless
  29.     you specify -comments on the command line.
  30.   Lines are stroked only once in the output, not twice.
  31.   Fonts aren't defined as redundantly as before in the output.
  32.  
  33. - Fixed where strings are placed when rotated.  Before, if you 
  34.   rotated a string and specified any justification besides hjl vjl, 
  35.   the strings weren't really placed in any kind of reliable location.
  36.   Now, the strings are rotated about their justification point.  See 
  37.   the man page.
  38.  
  39. - Added an optional argument to copygraph, copystring and copycurve.
  40.  
  41. - I received a request to put error bars into jgraph.  I don't really
  42.   have the time to do this right now.  Until I get around to it (if ever),
  43.   I've provided a way to get them using awk and the shell command.  This
  44.   is in the example etst.jgr, etc.  This is a powerful technique, so 
  45.   check it out.
  46.  
  47. This should be the last major patch for a while unless there are 
  48. important bug fixes.  As always, send me your questions/comments/bug
  49. reports.
  50.  
  51. (read the README to answer questions about where to get jgraph, etc.)
  52.  
  53. Jim
  54.  
  55. Patch from 7.2:
  56.  
  57. *** ../work/README    Tue Feb  4 12:27:44 1992
  58. --- README    Tue Feb  4 12:24:06 1992
  59. ***************
  60. *** 1,4 ****
  61. ! $Revision: 7.2 $
  62.   
  63.   Jgraph takes the description of a graph or graphs in the standard
  64.   input, and produces a postscript file on the standard output.  Jgraph
  65. --- 1,4 ----
  66. ! $Revision: 7.3 $
  67.   
  68.   Jgraph takes the description of a graph or graphs in the standard
  69.   input, and produces a postscript file on the standard output.  Jgraph
  70. *** ../work/draw.c    Tue Feb  4 12:27:46 1992
  71. --- draw.c    Tue Feb  4 12:24:07 1992
  72. ***************
  73. *** 1,7 ****
  74.   /* 
  75.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/draw.c,v $
  76. !  * $Revision: 7.2 $
  77. !  * $Date: 92/01/27 12:55:44 $
  78.    * $Author: jsp $
  79.    */
  80.   
  81. --- 1,7 ----
  82.   /* 
  83.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/draw.c,v $
  84. !  * $Revision: 7.3 $
  85. !  * $Date: 92/02/04 12:20:48 $
  86.    * $Author: jsp $
  87.    */
  88.   
  89. ***************
  90. *** 56,62 ****
  91.     orientation = (a->is_x) ? 'x' : 'y';
  92.     setlinewidth(1.0);
  93.     comment("Drawing Axis");
  94. !   printf("gsave %f setgray\n", a->gray);
  95.     if (a->draw_axis_line) {
  96.       printline(0.0, a->draw_at, a->psize, a->draw_at, orientation);
  97.     }
  98. --- 56,63 ----
  99.     orientation = (a->is_x) ? 'x' : 'y';
  100.     setlinewidth(1.0);
  101.     comment("Drawing Axis");
  102. !   gsave();
  103. !   printf("%f setgray\n", a->gray);
  104.     if (a->draw_axis_line) {
  105.       printline(0.0, a->draw_at, a->psize, a->draw_at, orientation);
  106.     }
  107. ***************
  108. *** 89,95 ****
  109.       comment("Drawing Axis Label");
  110.       draw_label(a->label);
  111.     }
  112. !   printf("  grestore\n");
  113.   }
  114.   
  115.   
  116. --- 90,97 ----
  117.       comment("Drawing Axis Label");
  118.       draw_label(a->label);
  119.     }
  120. !   grestore();
  121. !   printf("\n");
  122.   }
  123.   
  124.   
  125. ***************
  126. *** 117,128 ****
  127.   {
  128.     Curve c;
  129.   
  130. !   printf("gsave\n");
  131.     if (g->clip) set_clip(g);
  132.     for(c = first(g->curves); c != nil(g->curves); c = next(c)) {
  133.       draw_curve(c, g);
  134.     }
  135. !   printf(" grestore\n");
  136.   }
  137.   
  138.   draw_curve(c, g)
  139. --- 119,132 ----
  140.   {
  141.     Curve c;
  142.   
  143. !   gsave();
  144. !   printf("\n");
  145.     if (g->clip) set_clip(g);
  146.     for(c = first(g->curves); c != nil(g->curves); c = next(c)) {
  147.       draw_curve(c, g);
  148.     }
  149. !   grestore();
  150. !   printf("\n");
  151.   }
  152.   
  153.   draw_curve(c, g)
  154. ***************
  155. *** 133,139 ****
  156.     int i, j;
  157.      float this_x, this_y, last_x, last_y;
  158.   
  159. !   printf("gsave %f setgray\n", c->gray);
  160.     if (c->clip) set_clip(g);
  161.     comment("Drawing Curve");
  162.     if (c->linetype != '0') {
  163. --- 137,144 ----
  164.     int i, j;
  165.      float this_x, this_y, last_x, last_y;
  166.   
  167. !   gsave();
  168. !   printf("%f setgray\n", c->gray);
  169.     if (c->clip) set_clip(g);
  170.     comment("Drawing Curve");
  171.     if (c->linetype != '0') {
  172. ***************
  173. *** 199,205 ****
  174.       last_y = this_y;  
  175.       i = (i + 1) % 3;
  176.     }
  177. !   printf("     grestore\n");
  178.   }
  179.   
  180.   draw_mark(x, y, c, g)
  181. --- 204,211 ----
  182.       last_y = this_y;  
  183.       i = (i + 1) % 3;
  184.     }
  185. !   grestore();
  186. !   printf("\n");
  187.   }
  188.   
  189.   draw_mark(x, y, c, g)
  190. ***************
  191. *** 304,315 ****
  192.     dy = y1 - y2;
  193.     if (dx == 0.0 && dy == 0.0) return;
  194.   
  195. !   printf("gsave %f %f translate %f %f atan rotate\n", x1, y1, dy, dx);
  196.     start_poly(0.0, 0.0);
  197.     cont_poly(-(c->asize[0]), (c->asize[1]));
  198.     cont_poly(-(c->asize[0]), -(c->asize[1]));
  199.     end_poly(c->fill);
  200. !   printf("      grestore\n");
  201.   }
  202.   
  203.   draw_legend(g)
  204. --- 310,323 ----
  205.     dy = y1 - y2;
  206.     if (dx == 0.0 && dy == 0.0) return;
  207.   
  208. !   gsave();
  209. !   printf("%f %f translate %f %f atan rotate\n", x1, y1, dy, dx);
  210.     start_poly(0.0, 0.0);
  211.     cont_poly(-(c->asize[0]), (c->asize[1]));
  212.     cont_poly(-(c->asize[0]), -(c->asize[1]));
  213.     end_poly(c->fill);
  214. !   grestore();
  215. !   printf("\n");
  216.   }
  217.   
  218.   draw_legend(g)
  219. ***************
  220. *** 325,331 ****
  221.     if (l->type == 'n') return;
  222.     for (c = first(g->curves); c != nil(g->curves); c = next(c)) {
  223.       if (c->l->label != CNULL) {
  224. !       printf("gsave %f setgray\n", c->gray);
  225.         y = c->l->y - (c->l->fontsize / 2.0 * FCPI / FPPI);
  226.         if (l->anylines) {
  227.           if (c->linetype != '0' && l->linelength != 0) {
  228. --- 333,340 ----
  229.     if (l->type == 'n') return;
  230.     for (c = first(g->curves); c != nil(g->curves); c = next(c)) {
  231.       if (c->l->label != CNULL) {
  232. !       gsave();
  233. !       printf("%f setgray\n", c->gray);
  234.         y = c->l->y - (c->l->fontsize / 2.0 * FCPI / FPPI);
  235.         if (l->anylines) {
  236.           if (c->linetype != '0' && l->linelength != 0) {
  237. ***************
  238. *** 350,356 ****
  239.         } else {
  240.           draw_mark(x, y, c, g);
  241.         }
  242. !       printf("grestore\n");
  243.         draw_label(c->l);
  244.       }
  245.     }
  246. --- 359,366 ----
  247.         } else {
  248.           draw_mark(x, y, c, g);
  249.         }
  250. !       grestore();
  251. !       printf("\n");
  252.         draw_label(c->l);
  253.       }
  254.     }
  255. ***************
  256. *** 433,438 ****
  257. --- 443,450 ----
  258.     }
  259.     printf("1 setlinecap 1 setlinejoin\n");
  260.     printf("0.700 setlinewidth\n");
  261. +   gsave();
  262. +   setfont("Times-Roman", 9.00);
  263.   }
  264.   
  265.   draw_footer(gs, pp)
  266. ***************
  267. *** 440,444 ****
  268. --- 452,457 ----
  269.   int pp;
  270.   {
  271.     printf("$F2psEnd\n");
  272. +   grestore();
  273.     if (pp) printf("showpage\n");
  274.   }
  275. *** ../work/edit.c    Tue Feb  4 12:27:47 1992
  276. --- edit.c    Tue Feb  4 12:24:07 1992
  277. ***************
  278. *** 1,7 ****
  279.   /* 
  280.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/edit.c,v $
  281. !  * $Revision: 7.2 $
  282. !  * $Date: 92/01/27 12:55:45 $
  283.    * $Author: jsp $
  284.    */
  285.   
  286. --- 1,7 ----
  287.   /* 
  288.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/edit.c,v $
  289. !  * $Revision: 7.3 $
  290. !  * $Date: 92/02/04 12:20:49 $
  291.    * $Author: jsp $
  292.    */
  293.   
  294. ***************
  295. *** 147,175 ****
  296.     Curve lastc, newc;
  297.     Graph oldg;
  298.     Graphs oldgs;
  299.   
  300. !   oldg = g;
  301. !   oldgs = gs;
  302. !   while(gs != nil(all_gs)) {
  303. !     if (gs != oldgs) g = last(gs->g);
  304. !     while(g != nil(gs->g)) {
  305. !       if (first(g->curves) == nil(g->curves)) g = prev(g);
  306. !       else {
  307. !         lastc = last(g->curves);
  308. !         if (first(oldg->curves) == nil(oldg->curves))
  309. !           newc = new_curve(oldg->curves, 0);
  310. !         else newc = new_curve(oldg->curves, last(oldg->curves)->num + 1);
  311.           copy_curve(newc, lastc);
  312.           return newc;
  313.         }
  314.       }
  315. -     gs = prev(gs);
  316.     }
  317. -   
  318. -   error_header(); 
  319. -   fprintf(stderr, "Cannot perform copycurve on first curve\n");
  320. -   exit(1);
  321.     return newc; /* To shut lint up */
  322.   }
  323.   
  324. --- 147,194 ----
  325.     Curve lastc, newc;
  326.     Graph oldg;
  327.     Graphs oldgs;
  328. +   int num;
  329.   
  330. !   if (!getint(&num)) {
  331. !     rejecttoken();
  332. !     oldg = g;
  333. !     oldgs = gs;
  334. !     while(gs != nil(all_gs)) {
  335. !       if (gs != oldgs) g = last(gs->g);
  336. !       while(g != nil(gs->g)) {
  337. !         if (first(g->curves) == nil(g->curves)) g = prev(g);
  338. !         else {
  339. !           lastc = last(g->curves);
  340. !           if (first(oldg->curves) == nil(oldg->curves))
  341. !             newc = new_curve(oldg->curves, 0);
  342. !           else newc = new_curve(oldg->curves, last(oldg->curves)->num + 1);
  343. !           copy_curve(newc, lastc);
  344. !           return newc;
  345. !         }
  346. !       }
  347. !       gs = prev(gs);
  348. !     }
  349. !     error_header(); 
  350. !     fprintf(stderr, "Cannot perform copycurve on first curve\n");
  351. !     exit(1);
  352. !   } else {
  353. !     if (first(g->curves) == nil(g->curves))
  354. !       newc = new_curve(g->curves, 0);
  355. !     else newc = new_curve(g->curves, last(g->curves)->num + 1);
  356. !     lastc = g->curves; 
  357. !     while(1) {
  358. !       lastc = prev(lastc);
  359. !       if (lastc == nil(g->curves) || lastc->num < num) {
  360. !         error_header(); 
  361. !         fprintf(stderr, "copycurve: curve #%d not found\n", num);
  362. !         exit(1);
  363. !       }
  364. !       if (lastc->num == num) {
  365.           copy_curve(newc, lastc);
  366.           return newc;
  367.         }
  368.       }
  369.     }
  370.     return newc; /* To shut lint up */
  371.   }
  372.   
  373. ***************
  374. *** 181,213 ****
  375.     String lastl, newl;
  376.     Graph oldg;
  377.     Graphs oldgs;
  378.   
  379. !   oldg = g;
  380. !   oldgs = gs;
  381. !   while(gs != nil(all_gs)) {
  382. !     if (gs != oldgs) g = last(gs->g);
  383. !     while(g != nil(gs->g)) {
  384. !       if (first(g->strings) == nil(g->strings)) g = prev(g);
  385. !       else {
  386. !         lastl = last(g->strings);
  387. !         if (first(oldg->strings) == nil(oldg->strings))
  388. !           newl = new_string(oldg->strings, 0);
  389. !         else newl = new_string(oldg->strings, last(oldg->strings)->num + 1);
  390.           copy_label(newl->s, lastl->s);
  391.           return newl->s;
  392.         }
  393.       }
  394. -     gs = prev(gs);
  395.     }
  396. -   
  397. -   error_header(); 
  398. -   fprintf(stderr, "Cannot perform copystring on first curve\n");
  399. -   exit(1);
  400. -   return newl->s; /* To shut lint up */
  401.   }
  402.   
  403. ! inherit_axes(g, gs, all_gs)
  404.   Graph g;
  405.   Graphs gs;
  406.   Graphs all_gs;
  407. --- 200,251 ----
  408.     String lastl, newl;
  409.     Graph oldg;
  410.     Graphs oldgs;
  411. +   int num;
  412.   
  413. !   if (!getint(&num)) {
  414. !     rejecttoken();
  415. !     oldgs = gs;
  416. !     oldg = g;
  417. !     while(gs != nil(all_gs)) {
  418. !       if (gs != oldgs) g = last(gs->g);
  419. !       while(g != nil(gs->g)) {
  420. !         if (first(g->strings) == nil(g->strings)) g = prev(g);
  421. !         else {
  422. !           lastl = last(g->strings);
  423. !           if (first(oldg->strings) == nil(oldg->strings))
  424. !             newl = new_string(oldg->strings, 0);
  425. !           else newl = new_string(oldg->strings, last(oldg->strings)->num + 1);
  426. !           copy_label(newl->s, lastl->s);
  427. !           return newl->s;
  428. !         }
  429. !       }
  430. !       gs = prev(gs);
  431. !     }
  432. !     error_header(); 
  433. !     fprintf(stderr, "Cannot perform copystring on first string\n");
  434. !     exit(1);
  435. !     return newl->s; /* To shut lint up */
  436. !   } else {
  437. !     if (first(g->strings) == nil(g->strings))
  438. !       newl = new_string(g->strings, 0);
  439. !     else newl = new_string(g->strings, last(g->strings)->num + 1);
  440. !     lastl = g->strings; 
  441. !     while(1) {
  442. !       lastl = prev(lastl);
  443. !       if (lastl == nil(g->strings) || lastl->num < num) {
  444. !         error_header(); 
  445. !         fprintf(stderr, "copystring: string #%d not found\n", num);
  446. !         exit(1);
  447. !       }
  448. !       if (lastl->num == num) {
  449.           copy_label(newl->s, lastl->s);
  450.           return newl->s;
  451.         }
  452.       }
  453.     }
  454.   }
  455.   
  456. ! Graph last_graph(g, gs, all_gs)
  457.   Graph g;
  458.   Graphs gs;
  459.   Graphs all_gs;
  460. ***************
  461. *** 214,219 ****
  462. --- 252,258 ----
  463.   {
  464.     Graph lastg;
  465.   
  466.     lastg = prev(g);
  467.     while(lastg == nil(gs->g)) {
  468.       if (prev(gs) == nil(all_gs)) {
  469. ***************
  470. *** 225,231 ****
  471. --- 264,276 ----
  472.         lastg = last(gs->g);
  473.       }
  474.     }
  475. +   return lastg;
  476. + }
  477.   
  478. + inherit_axes(g, lastg)
  479. + Graph g;
  480. + Graph lastg;
  481. + {
  482.     copy_axis(g->x_axis, lastg->x_axis);
  483.     copy_axis(g->y_axis, lastg->y_axis);
  484.     g->x_translate = lastg->x_translate;
  485. ***************
  486. *** 608,614 ****
  487.       } else if (strcmp(inp_str, "copystring") == 0) {
  488.         edit_label(do_copy_string(g, gs, all_gs));
  489.       } else if (strcmp(inp_str, "inherit_axes") == 0) {
  490. !       inherit_axes(g, gs, all_gs);
  491.       } else if (strcmp(inp_str, "Y") == 0) {
  492.         if (!getfloat(&f)) rejecttoken(); else gs->height = f;
  493.       } else if (strcmp(inp_str, "X") == 0) {
  494. --- 653,659 ----
  495.       } else if (strcmp(inp_str, "copystring") == 0) {
  496.         edit_label(do_copy_string(g, gs, all_gs));
  497.       } else if (strcmp(inp_str, "inherit_axes") == 0) {
  498. !       inherit_axes(g, last_graph(g, gs, all_gs));
  499.       } else if (strcmp(inp_str, "Y") == 0) {
  500.         if (!getfloat(&f)) rejecttoken(); else gs->height = f;
  501.       } else if (strcmp(inp_str, "X") == 0) {
  502. ***************
  503. *** 632,641 ****
  504.   Graphs gs;
  505.   {
  506.     Graphs the_g;
  507. !   Graph g;
  508.     char inp_str[80];
  509.     float f;
  510. !   int num, i;
  511.   
  512.     the_g = first(gs);
  513.     while ( getstring(inp_str) ) {
  514. --- 677,686 ----
  515.   Graphs gs;
  516.   {
  517.     Graphs the_g;
  518. !   Graph g, tmp_g;
  519.     char inp_str[80];
  520.     float f;
  521. !   int num, i, ok;
  522.   
  523.     the_g = first(gs);
  524.     while ( getstring(inp_str) ) {
  525. ***************
  526. *** 653,659 ****
  527.         if (first(the_g->g) == nil(the_g->g))
  528.           g = new_graph(the_g->g, 0);
  529.         else g = new_graph(the_g->g, last(the_g->g)->num + 1);
  530. !       inherit_axes(g, the_g, gs);
  531.         edit_graph(g, the_g, gs);
  532.       } else if (strcmp(inp_str, "Y") == 0) {
  533.         if (!getfloat(&f)) rejecttoken(); else the_g->height = f;
  534. --- 698,720 ----
  535.         if (first(the_g->g) == nil(the_g->g))
  536.           g = new_graph(the_g->g, 0);
  537.         else g = new_graph(the_g->g, last(the_g->g)->num + 1);
  538. !       if (!getint(&num)) {
  539. !         rejecttoken();
  540. !         inherit_axes(g, last_graph(g, the_g, gs));
  541. !       } else {
  542. !         ok = 0;
  543. !         tmp_g = the_g->g;
  544. !         while(!ok) {
  545. !           tmp_g = prev(tmp_g);
  546. !           if (tmp_g == nil(the_g->g) || tmp_g->num < num) {
  547. !             error_header();
  548. !             fprintf(stderr, "copygraph: no graph #%d\n", num);
  549. !             exit(1);
  550. !           }
  551. !           ok = (tmp_g->num == num);
  552. !         }
  553. !         inherit_axes(g, tmp_g);
  554. !       }
  555.         edit_graph(g, the_g, gs);
  556.       } else if (strcmp(inp_str, "Y") == 0) {
  557.         if (!getfloat(&f)) rejecttoken(); else the_g->height = f;
  558. *** /dev/null    Tue Feb  4 12:14:21 1992
  559. --- epts.awk    Tue Feb  4 12:24:22 1992
  560. ***************
  561. *** 0 ****
  562. --- 1,11 ----
  563. + BEGIN    { l = 0 ; }
  564. +     { if (l == 0) {\
  565. +         l = 1; \
  566. +         c1 = $1; \
  567. +           } else { \
  568. +         printf("  curve %d pts %f %f\n", c1, $1, $2); \
  569. +         printf("  copycurve pts %f %f  %f %f\n", \
  570. +               $1, $2 - $3/2.0, $1, $2 + $3/2.0); \
  571. +           } \
  572. +         }
  573. +           
  574. *** /dev/null    Tue Feb  4 12:14:21 1992
  575. --- etst.jgr    Tue Feb  4 12:24:16 1992
  576. ***************
  577. *** 0 ****
  578. --- 1,10 ----
  579. + newgraph
  580. + xaxis min 0 max 100 size 6 hash 20 mhash 1
  581. + yaxis min 0 max 100 size 8 hash 10 mhash 1
  582. + curve 0 marktype circle fill 0 linetype dashed
  583. + curve 1 marktype cross marksize 1 0 linetype solid
  584. + shell 
  585. + : ( echo "0" ; cat etst.pts ) | awk -f epts.awk
  586. *** /dev/null    Tue Feb  4 12:14:21 1992
  587. --- etst.pts    Tue Feb  4 12:24:20 1992
  588. ***************
  589. *** 0 ****
  590. --- 1,11 ----
  591. + 0 0 0
  592. + 10 30 5
  593. + 20 60 20
  594. + 30 5 2
  595. + 40 10 10
  596. + 50 20 10
  597. + 60 30 7
  598. + 70 60 30
  599. + 80 80 20
  600. + 90 50 2
  601. + 100 95 10
  602. *** ../work/jgraph.1    Tue Feb  4 12:27:52 1992
  603. --- jgraph.1    Tue Feb  4 12:24:15 1992
  604. ***************
  605. *** 7,12 ****
  606. --- 7,13 ----
  607.   .B jgraph 
  608.   [\-\fIp\fR\|]
  609.   [\-\fIP\fR\|]
  610. + [\-\fIcomments\fR\|]
  611.   .SH DESCRIPTION
  612.   \fBJgraph\fR
  613.   takes the description of a graph or graphs in the standard
  614. ***************
  615. *** 88,93 ****
  616. --- 89,99 ----
  617.   with all the defaults made explicit.  This is useful for letting the
  618.   user do his/her own special formatting, as it shows the explicit
  619.   values that the defaults assume, so that they can be manipulated.
  620. + .TP
  621. + .B \-comments
  622. + This option makes jgraph put comments into the output postscript.  These
  623. + make it easier for the user to wade through the final postscript if 
  624. + necessary. 
  625.   .SH THE DESCRIPTION LANGUAGE
  626.   The description language is essentially keywords followed by
  627.   attributes.  All keywords and attributes except for string attributes
  628. ***************
  629. *** 200,220 ****
  630.   where n=0 if this is the first graph, otherwise n=m+1, where m is the
  631.   largest number of any graph so far.
  632.   .TP
  633. ! .B copygraph
  634.   This creates a new graph, and copies all the attributes from the
  635. ! previous graph's x and y axes, as well as the x_translate and 
  636. ! y_translate values, and the clipping. 
  637. ! (Actually, this is a little bit of a lie, as it does not copy the
  638. ! values of the 
  639. ! \fB\fIhash_at\fB, \fImhash_at\fB,\fR
  640. ! and 
  641. ! \fB\fI\fIhash_label\fB\fR 
  642. ! attributes). 
  643. ! The previous graph is defined to be the graph with the largest number 
  644.   less than the currrent graph's number.  If the current 
  645.   graph has the smallest number, then it will take the last graph from 
  646.   the previous page of graphs.  If there is no previous page, then an 
  647.   error will be flagged.
  648.   .TP
  649.   .B newpage
  650.   This command is for plotting graphs on multiple pages.  After a 
  651. --- 206,230 ----
  652.   where n=0 if this is the first graph, otherwise n=m+1, where m is the
  653.   largest number of any graph so far.
  654.   .TP
  655. ! \fBcopygraph \|[\fIinteger\fB\|]\fR
  656.   This creates a new graph, and copies all the attributes from the
  657. ! graph
  658. ! \fB\|[\fIinteger\fB\|]'s\fR
  659. ! x and y axes, as well as its x_translate and 
  660. ! y_translate values, and the clipping.   If the
  661. ! \fB\|[\fIinteger\fB\|]\fR
  662. ! is omitted, then it copies its values from the ``previous''
  663. ! graph, which is 
  664. ! defined to be the graph with the largest number 
  665.   less than the currrent graph's number.  If the current 
  666.   graph has the smallest number, then it will take the last graph from 
  667.   the previous page of graphs.  If there is no previous page, then an 
  668.   error will be flagged.
  669. + (copygraph does not copy the values of the 
  670. + \fB\fIhash_at\fB, \fImhash_at\fB,\fR
  671. + and 
  672. + \fB\fI\fIhash_label\fB\fR 
  673. + attributes). 
  674.   .TP
  675.   .B newpage
  676.   This command is for plotting graphs on multiple pages.  After a 
  677. ***************
  678. *** 323,331 ****
  679.   .fi
  680.   .PP
  681.   .TP
  682. ! \fBcopycurve\fR  
  683.   This starts editing a new curve of the graph, and copies all its 
  684. ! values from last curve in this graph.  If this graph currently has
  685.   no curves, then it searches backwards from the previous graph.
  686.   .TP
  687.   \fBtitle\fR   
  688. --- 333,346 ----
  689.   .fi
  690.   .PP
  691.   .TP
  692. ! \fBcopycurve \|[\fIinteger\fB\|]\fR
  693.   This starts editing a new curve of the graph, and copies all its 
  694. ! values except for the points from curve 
  695. ! \fB\|[\fIinteger.\fB\|]\fR
  696. ! If the 
  697. ! \fB\|[\fIinteger\fB\|]\fR
  698. ! is omitted, then it copies its values from the 
  699. ! last curve in this graph.  If this graph currently has
  700.   no curves, then it searches backwards from the previous graph.
  701.   .TP
  702.   \fBtitle\fR   
  703. ***************
  704. *** 348,354 ****
  705.   .br
  706.   .ns
  707.   .TP
  708. ! \fBcopystring\fR
  709.   \fBString\fR
  710.   and
  711.   \fBcopystring\fR
  712. --- 363,369 ----
  713.   .br
  714.   .ns
  715.   .TP
  716. ! \fBcopystring \|[\fIinteger\fB\|]\fR
  717.   \fBString\fR
  718.   and
  719.   \fBcopystring\fR
  720. ***************
  721. *** 824,836 ****
  722.   \fBrotate \|[\fIfloat\fB\|]\fR   
  723.   This will rotate the string 
  724.   \fB\|[\fIfloat\fB\|] \fR
  725. ! degrees.  At
  726. ! the moment, the only rotations which work cleanly are: 0, 90 & 
  727. ! \fBvjc,\fR
  728. ! -90 and 
  729. ! \fBvjc,\fR
  730. ! and anything else where rotation should be around the left, bottom corner
  731. ! of the string. 
  732.   .PD
  733.   .RE
  734.   .LP
  735. --- 839,851 ----
  736.   \fBrotate \|[\fIfloat\fB\|]\fR   
  737.   This will rotate the string 
  738.   \fB\|[\fIfloat\fB\|] \fR
  739. ! degrees.  The point of rotation is defined by the
  740. ! \fBvj\fR
  741. ! and 
  742. ! \fBhj\fR
  743. ! commands.  For example, to rotate 90 degrees about the center of a string, 
  744. ! one would use
  745. ! \fBvjc hjc rotate 90.\fR
  746.   .PD
  747.   .RE
  748.   .LP
  749. ***************
  750. *** 1201,1204 ****
  751.   .sp
  752.   There may well be loads of other bugs.  Send to jsp@princeton.edu.
  753.   .sp
  754. ! This is $Revision: 7.2 $.
  755. --- 1216,1219 ----
  756.   .sp
  757.   There may well be loads of other bugs.  Send to jsp@princeton.edu.
  758.   .sp
  759. ! This is $Revision: 7.3 $.
  760. *** ../work/jgraph.c    Tue Feb  4 12:27:53 1992
  761. --- jgraph.c    Tue Feb  4 12:24:08 1992
  762. ***************
  763. *** 1,7 ****
  764.   /* 
  765.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/jgraph.c,v $
  766. !  * $Revision: 7.2 $
  767. !  * $Date: 92/01/27 12:55:50 $
  768.    * $Author: jsp $
  769.    */
  770.   
  771. --- 1,7 ----
  772.   /* 
  773.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/jgraph.c,v $
  774. !  * $Revision: 7.3 $
  775. !  * $Date: 92/02/04 12:20:57 $
  776.    * $Author: jsp $
  777.    */
  778.   
  779. ***************
  780. *** 271,276 ****
  781. --- 271,277 ----
  782.     Graphs gs;
  783.     int i;
  784.     int show, pp;
  785. +   int comments;
  786.   
  787.   #ifdef VMS 
  788.     IOSTREAM = stdin;    /* for token.c -hdd */
  789. ***************
  790. *** 277,287 ****
  791. --- 278,292 ----
  792.   #endif
  793.     show = 0;
  794.     pp = 0;
  795. +   comments = 0;
  796.     for (i = 1; i < argc; i++) {
  797.       if (strcmp(argv[i], "-p") == 0) show = 1;
  798. +     if (strcmp(argv[i], "-comments") == 0) comments = 1;
  799.       else if (strcmp(argv[i], "-P") == 0) pp = 1;
  800.     }
  801.     gs = (Graphs) make_list(sizeof(struct graphs));
  802. +   set_comment(comments);
  803.     new_graphs(gs);
  804.     edit_graphs(gs);
  805.     process_graphs(gs);
  806. *** ../work/jgraph.h    Tue Feb  4 12:27:54 1992
  807. --- jgraph.h    Tue Feb  4 12:24:09 1992
  808. ***************
  809. *** 1,7 ****
  810.   /* 
  811.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/jgraph.h,v $
  812. !  * $Revision: 7.2 $
  813. !  * $Date: 92/01/27 12:55:52 $
  814.    * $Author: jsp $
  815.    */
  816.   
  817. --- 1,7 ----
  818.   /* 
  819.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/jgraph.h,v $
  820. !  * $Revision: 7.3 $
  821. !  * $Date: 92/02/04 12:21:00 $
  822.    * $Author: jsp $
  823.    */
  824.   
  825. *** ../work/list.c    Tue Feb  4 12:27:54 1992
  826. --- list.c    Tue Feb  4 12:24:10 1992
  827. ***************
  828. *** 1,7 ****
  829.   /* 
  830.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/list.c,v $
  831. !  * $Revision: 7.2 $
  832. !  * $Date: 92/01/27 12:55:53 $
  833.    * $Author: jsp $
  834.    */
  835.   
  836. --- 1,7 ----
  837.   /* 
  838.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/list.c,v $
  839. !  * $Revision: 7.3 $
  840. !  * $Date: 92/02/04 12:21:02 $
  841.    * $Author: jsp $
  842.    */
  843.   
  844. *** ../work/list.h    Tue Feb  4 12:27:55 1992
  845. --- list.h    Tue Feb  4 12:24:10 1992
  846. ***************
  847. *** 1,7 ****
  848.   /* 
  849.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/list.h,v $
  850. !  * $Revision: 7.2 $
  851. !  * $Date: 92/01/27 12:55:54 $
  852.    * $Author: jsp $
  853.    */
  854.   
  855. --- 1,7 ----
  856.   /* 
  857.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/list.h,v $
  858. !  * $Revision: 7.3 $
  859. !  * $Date: 92/02/04 12:21:04 $
  860.    * $Author: jsp $
  861.    */
  862.   
  863. *** ../work/printline.c    Tue Feb  4 12:27:56 1992
  864. --- printline.c    Tue Feb  4 12:24:10 1992
  865. ***************
  866. *** 1,7 ****
  867.   /* 
  868.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/printline.c,v $
  869. !  * $Revision: 7.2 $
  870. !  * $Date: 92/01/27 12:55:56 $
  871.    * $Author: jsp $
  872.    */
  873.   
  874. --- 1,7 ----
  875.   /* 
  876.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/printline.c,v $
  877. !  * $Revision: 7.3 $
  878. !  * $Date: 92/02/04 12:21:40 $
  879.    * $Author: jsp $
  880.    */
  881.   
  882. ***************
  883. *** 10,24 ****
  884.   
  885.   #define LINEWIDTHFACTOR 0.700
  886.   
  887.   printline(x1, y1,x2, y2, orientation)
  888.   float x1, y1, x2, y2;
  889.   char orientation;
  890.   {
  891.     if (orientation == 'x') 
  892. !     printf("newpath %f %f moveto %f %f lineto stroke\nstroke\n",
  893.             x1, y1, x2, y2);
  894.     else
  895. !     printf("newpath %f %f moveto %f %f lineto stroke\nstroke\n",
  896.             y1, x1, y2, x2);} 
  897.   
  898.   start_line(x1, y1, c)
  899. --- 10,88 ----
  900.   
  901.   #define LINEWIDTHFACTOR 0.700
  902.   
  903. + typedef struct fontlist {
  904. +   struct fontlist *flink;
  905. +   struct fontlist *blink;
  906. +   int level;
  907. +   float s;
  908. +   char *f;
  909. + } *Fontlist;
  910. + static Fontlist Jgraph_fonts;
  911. + static int Jgraph_gsave_level = -100;
  912. + static int Jgraph_comment;
  913. + gsave()
  914. + {
  915. +   if (Jgraph_gsave_level == -100) {
  916. +     Jgraph_gsave_level = 0;
  917. +     Jgraph_fonts = (Fontlist) make_list(sizeof(struct fontlist));
  918. +   } 
  919. +   Jgraph_gsave_level++;
  920. +   printf(" gsave ");
  921. + }
  922. + grestore()
  923. + {
  924. +   Fontlist l;
  925. +   if (last(Jgraph_fonts) != nil(Jgraph_fonts)) {
  926. +     l = last(Jgraph_fonts);
  927. +     if (l->level == Jgraph_gsave_level) {
  928. +       delete_item(l);
  929. +       free_node(l, Jgraph_fonts);
  930. +     }
  931. +   }
  932. +   Jgraph_gsave_level--;
  933. +   printf(" grestore ");
  934. + }
  935. + setfont(f, s)
  936. + char *f;
  937. + float s;
  938. + {
  939. +   Fontlist l;
  940. +   int ins;
  941. +   if (last(Jgraph_fonts) != nil(Jgraph_fonts)) {
  942. +     l = last(Jgraph_fonts);
  943. +     ins = (strcmp(l->f, f) != 0 || s != l->s);
  944. +     if (ins) {
  945. +       delete_item(l);
  946. +       free_node(l, Jgraph_fonts);
  947. +     }
  948. +   } else {
  949. +     ins = 1;
  950. +   }
  951. +   if (ins) {
  952. +     l = (Fontlist) get_node(Jgraph_fonts);
  953. +     l->level = Jgraph_gsave_level;
  954. +     l->s = s;
  955. +     l->f = f;
  956. +     insert(l, Jgraph_fonts);
  957. +     printf("/%s findfont %f scalefont setfont\n", f, s);
  958. +   }
  959. + }
  960. +   
  961.   printline(x1, y1,x2, y2, orientation)
  962.   float x1, y1, x2, y2;
  963.   char orientation;
  964.   {
  965.     if (orientation == 'x') 
  966. !     printf("newpath %f %f moveto %f %f lineto stroke\n",
  967.             x1, y1, x2, y2);
  968.     else
  969. !     printf("newpath %f %f moveto %f %f lineto stroke\n",
  970.             y1, x1, y2, x2);} 
  971.   
  972.   start_line(x1, y1, c)
  973. ***************
  974. *** 38,44 ****
  975.   
  976.   end_line()
  977.   {
  978. !   printf("stroke\n stroke\n");
  979.     setlinewidth(1.0);
  980.     setlinestyle('s', (Flist) 0);
  981.   
  982. --- 102,108 ----
  983.   
  984.   end_line()
  985.   {
  986. !   printf("stroke\n");
  987.     setlinewidth(1.0);
  988.     setlinestyle('s', (Flist) 0);
  989.   
  990. ***************
  991. *** 74,81 ****
  992.   {
  993.     if (fill < 0.0) printf("closepath stroke\n");
  994.     else {
  995. !     printf("closepath gsave  %f setgray ", fill);
  996. !     printf("fill grestore stroke\n");
  997.     }
  998.   }
  999.   
  1000. --- 138,146 ----
  1001.   {
  1002.     if (fill < 0.0) printf("closepath stroke\n");
  1003.     else {
  1004. !     printf("closepath gsave");
  1005. !     printf(" %f setgray fill ", fill);
  1006. !     printf("grestore stroke\n");
  1007.     }
  1008.   }
  1009.   
  1010. ***************
  1011. *** 88,97 ****
  1012.       else printf("gsave  %f setgray fill grestore stroke\n", fill);
  1013.   }
  1014.   
  1015.   comment(s)
  1016.   char *s;
  1017.   {
  1018. !   printf("%% %s\n", s);
  1019.   }
  1020.   
  1021.   printline_c(x1, y1, x2, y2, g)
  1022. --- 153,168 ----
  1023.       else printf("gsave  %f setgray fill grestore stroke\n", fill);
  1024.   }
  1025.   
  1026. + set_comment(c)
  1027. + int c;
  1028. + {
  1029. +   Jgraph_comment = c;
  1030. + }
  1031.   comment(s)
  1032.   char *s;
  1033.   {
  1034. !   if (Jgraph_comment) printf("%% %s\n", s);
  1035.   }
  1036.   
  1037.   printline_c(x1, y1, x2, y2, g)
  1038. ***************
  1039. *** 111,138 ****
  1040.   char *font;
  1041.   float size;
  1042.   {
  1043. !   printf("/%s findfont %f scalefont setfont\n", font, size);
  1044.     printf("%f %f moveto\n", x, y);
  1045.     printf("(%s)", s);
  1046. !   if (r == 90.0 && vj == 'c') {
  1047. !     if (hj == 'c') printf("%f 0 rmoveto ", -size * FCPI / FPPI / 2.0);
  1048. !     printf("dup stringwidth pop 2 div neg 0 exch rmoveto ");
  1049. !   } else if (r == -90.0 && vj == 'c') {
  1050. !     if (hj == 'c') printf("%f 0 rmoveto ", -size * FCPI / FPPI / 2.0);
  1051. !     printf("dup stringwidth pop 2 div 0 exch rmoveto ");
  1052. !   } else {
  1053. !     if (hj == 'c') {
  1054. !       printf("dup stringwidth pop 2 div neg 0 rmoveto ");
  1055. !     } else if (hj == 'r') {
  1056. !       printf("dup stringwidth pop neg 0 rmoveto ");
  1057. !     }
  1058. !     if (vj == 'c') {
  1059. !       printf("0 %f rmoveto ", -size * FCPI / FPPI / 2.0);
  1060. !     } else if (vj == 't') {
  1061. !       printf("0 %f rmoveto ", -size * FCPI / FPPI);
  1062. !     }
  1063.     }
  1064. !   printf(" gsave  %f rotate show grestore\n", r);
  1065.   }
  1066.   
  1067.   setlinewidth(size)
  1068. --- 182,202 ----
  1069.   char *font;
  1070.   float size;
  1071.   {
  1072. !   setfont(font, size);
  1073.     printf("%f %f moveto\n", x, y);
  1074. +   printf(" gsave  %f rotate \n", r);
  1075.     printf("(%s)", s);
  1076. !   if (hj == 'c') {
  1077. !     printf("dup stringwidth pop 2 div neg 0 rmoveto ");
  1078. !   } else if (hj == 'r') {
  1079. !     printf("dup stringwidth pop neg 0 rmoveto ");
  1080.     }
  1081. !   if (vj == 'c') {
  1082. !     printf("0 %f rmoveto ", -size * FCPI / FPPI / 2.0);
  1083. !   } else if (vj == 't') {
  1084. !     printf("0 %f rmoveto ", -size * FCPI / FPPI);
  1085. !   }
  1086. !   printf("show grestore\n", r);
  1087.   }
  1088.   
  1089.   setlinewidth(size)
  1090. *** ../work/prio_list.c    Tue Feb  4 12:27:57 1992
  1091. --- prio_list.c    Tue Feb  4 12:24:11 1992
  1092. ***************
  1093. *** 1,7 ****
  1094.   /* 
  1095.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/prio_list.c,v $
  1096. !  * $Revision: 7.2 $
  1097. !  * $Date: 92/01/27 12:55:57 $
  1098.    * $Author: jsp $
  1099.    */
  1100.   
  1101. --- 1,7 ----
  1102.   /* 
  1103.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/prio_list.c,v $
  1104. !  * $Revision: 7.3 $
  1105. !  * $Date: 92/02/04 12:21:41 $
  1106.    * $Author: jsp $
  1107.    */
  1108.   
  1109. *** ../work/prio_list.h    Tue Feb  4 12:27:57 1992
  1110. --- prio_list.h    Tue Feb  4 12:24:11 1992
  1111. ***************
  1112. *** 1,7 ****
  1113.   /* 
  1114.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/prio_list.h,v $
  1115. !  * $Revision: 7.2 $
  1116. !  * $Date: 92/01/27 12:55:58 $
  1117.    * $Author: jsp $
  1118.    */
  1119.   
  1120. --- 1,7 ----
  1121.   /* 
  1122.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/prio_list.h,v $
  1123. !  * $Revision: 7.3 $
  1124. !  * $Date: 92/02/04 12:21:42 $
  1125.    * $Author: jsp $
  1126.    */
  1127.   
  1128. *** ../work/process.c    Tue Feb  4 12:27:58 1992
  1129. --- process.c    Tue Feb  4 12:24:12 1992
  1130. ***************
  1131. *** 1,7 ****
  1132.   /* 
  1133.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/process.c,v $
  1134. !  * $Revision: 7.2 $
  1135. !  * $Date: 92/01/27 12:55:59 $
  1136.    * $Author: jsp $
  1137.    */
  1138.   
  1139. --- 1,7 ----
  1140.   /* 
  1141.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/process.c,v $
  1142. !  * $Revision: 7.3 $
  1143. !  * $Date: 92/02/04 12:21:43 $
  1144.    * $Author: jsp $
  1145.    */
  1146.   
  1147. ***************
  1148. *** 16,21 ****
  1149. --- 16,23 ----
  1150.   #define AXIS_CHAR(a) ((a->is_x) ? 'x' : 'y')
  1151.   #define HASH_DIR(a) ((a->hash_scale > 0.0) ? 1 : -1)
  1152.   
  1153. + static double Pi;
  1154.   process_title(g)
  1155.   Graph g;
  1156.   {
  1157. ***************
  1158. *** 476,481 ****
  1159. --- 478,484 ----
  1160.   {
  1161.     Curve c;
  1162.     float y, x;
  1163. +   String s;
  1164.   
  1165.     g->xminval = 0.0;
  1166.     g->yminval = 0.0;
  1167. ***************
  1168. *** 489,497 ****
  1169.                       g->x_axis->label->fontsize);
  1170.     }
  1171.     if (g->y_axis->draw_axis_label) {
  1172. !     g->xminval = MIN(g->xminval, g->y_axis->label->y - 
  1173.                       g->y_axis->label->fontsize);
  1174. !     g->xmaxval = MAX(g->xmaxval, g->y_axis->label->y + 
  1175.                       g->y_axis->label->fontsize);
  1176.     }
  1177.   
  1178. --- 492,500 ----
  1179.                       g->x_axis->label->fontsize);
  1180.     }
  1181.     if (g->y_axis->draw_axis_label) {
  1182. !     g->xminval = MIN(g->xminval, g->y_axis->label->x - 
  1183.                       g->y_axis->label->fontsize);
  1184. !     g->xmaxval = MAX(g->xmaxval, g->y_axis->label->x + 
  1185.                       g->y_axis->label->fontsize);
  1186.     }
  1187.   
  1188. ***************
  1189. *** 545,550 ****
  1190. --- 548,556 ----
  1191.         }
  1192.       }
  1193.     }
  1194. +   for(s = first(g->strings); s != nil(g->strings); s = next(s)) {
  1195. +     process_label_extrema(s->s, g);
  1196. +   }
  1197.   }
  1198.   
  1199.   process_label_extrema(l, g)
  1200. ***************
  1201. *** 551,588 ****
  1202.   Label l;
  1203.   Graph g;
  1204.   {
  1205. !   float len;
  1206. !   float height;
  1207.   
  1208.     len = l->fontsize * FCPI / FPPI * strlen(l->label) * 0.8;
  1209.     height = l->fontsize * FCPI / FPPI;
  1210. !   if (l->rotate == 0.0 || l->rotate == 180.0 || l->rotate == -180.0) {
  1211. !     if (l->hj == 'l') {
  1212. !       g->xminval = MIN(g->xminval, l->x);
  1213. !       g->xmaxval = MAX(g->xmaxval, l->x + len);
  1214. !     } else if (l->hj == 'c') {
  1215. !       g->xminval = MIN(g->xminval, l->x - len/2.0);
  1216. !       g->xmaxval = MAX(g->xmaxval, l->x + len/2.0);
  1217. !     } else if (l->hj == 'r') {
  1218. !       g->xminval = MIN(g->xminval, l->x - len);
  1219. !       g->xmaxval = MAX(g->xmaxval, l->x);
  1220. !     }
  1221. !     if (l->vj == 'b') {
  1222. !       g->yminval = MIN(g->yminval, l->y);
  1223. !       g->ymaxval = MAX(g->ymaxval, l->y + height);
  1224. !     } else if (l->vj == 'c') {
  1225. !       g->yminval = MIN(g->yminval, l->y - height/2.0);
  1226. !       g->ymaxval = MAX(g->ymaxval, l->y + height/2.0);
  1227. !     } else if (l->vj == 't') {
  1228. !       g->yminval = MIN(g->yminval, l->y - height);
  1229. !       g->ymaxval = MAX(g->ymaxval, l->y);
  1230. !     }
  1231. !   } else {         /* This is wrong -- I'm just estimating on the high side */
  1232. !     g->yminval = MIN(g->yminval, l->y - len);
  1233. !     g->ymaxval = MAX(g->ymaxval, l->y + len);
  1234. !     g->xminval = MIN(g->xminval, l->x - len);
  1235. !     g->xmaxval = MAX(g->xmaxval, l->x + len);
  1236.     }
  1237.   }
  1238.   
  1239.   process_graph(g)
  1240. --- 557,610 ----
  1241.   Label l;
  1242.   Graph g;
  1243.   {
  1244. !   float len, height, xlen, ylen, xheight, yheight;
  1245. !   float x, y;
  1246.   
  1247.     len = l->fontsize * FCPI / FPPI * strlen(l->label) * 0.8;
  1248.     height = l->fontsize * FCPI / FPPI;
  1249. !   xlen = len * cos(l->rotate * Pi / 180.00);
  1250. !   ylen = height * cos((l->rotate + 90.0) * Pi / 180.00);
  1251. !   xheight = len * sin(l->rotate * Pi / 180.00);
  1252. !   yheight = height * sin((l->rotate + 90.0) * Pi / 180.00);
  1253. !   
  1254. !   x = l->x;
  1255. !   y = l->y;
  1256. !   if (l->hj == 'c') {
  1257. !     x -= xlen / 2.0;
  1258. !     y -= xheight / 2.0;
  1259. !   } else if (l->hj == 'r') {
  1260. !     x -= xlen;
  1261. !     y -= xheight;
  1262.     }
  1263. +   if (l->vj == 'c') {
  1264. +     x -= ylen / 2.0;
  1265. +     y -= yheight / 2.0;
  1266. +   } else if (l->vj == 't') {
  1267. +     x -= ylen;
  1268. +     y -= yheight;
  1269. +   }
  1270. +   g->xminval = MIN(g->xminval, x);
  1271. +   g->xminval = MIN(g->xminval, x + xlen);
  1272. +   g->xminval = MIN(g->xminval, x + xlen + ylen);
  1273. +   g->xminval = MIN(g->xminval, x + ylen);
  1274. +   g->yminval = MIN(g->yminval, y);
  1275. +   g->yminval = MIN(g->yminval, y + xheight);
  1276. +   g->yminval = MIN(g->yminval, y + yheight);
  1277. +   g->yminval = MIN(g->yminval, y + xheight + yheight);
  1278. +   g->xmaxval = MAX(g->xmaxval, x);
  1279. +   g->xmaxval = MAX(g->xmaxval, x + xlen);
  1280. +   g->xmaxval = MAX(g->xmaxval, x + xlen + ylen);
  1281. +   g->xmaxval = MAX(g->xmaxval, x + ylen);
  1282. +   g->ymaxval = MAX(g->ymaxval, y);
  1283. +   g->ymaxval = MAX(g->ymaxval, y + xheight);
  1284. +   g->ymaxval = MAX(g->ymaxval, y + yheight);
  1285. +   g->ymaxval = MAX(g->ymaxval, y + xheight + yheight);
  1286.   }
  1287.   
  1288.   process_graph(g)
  1289. ***************
  1290. *** 609,614 ****
  1291. --- 631,637 ----
  1292.     float diff, max_y, min_y, max_x, min_x;
  1293.     int do_bb, i;
  1294.   
  1295. +   Pi = acos(-1.0);
  1296.     for (the_g = first(gs); the_g != nil(gs); the_g = next(the_g)) {
  1297.       for (g = first(the_g->g); g != nil(the_g->g); g = next(g)) process_graph(g);
  1298.       max_x = 0.0;
  1299. *** ../work/show.c    Tue Feb  4 12:28:00 1992
  1300. --- show.c    Tue Feb  4 12:24:13 1992
  1301. ***************
  1302. *** 1,7 ****
  1303.   /* 
  1304.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/show.c,v $
  1305. !  * $Revision: 7.2 $
  1306. !  * $Date: 92/01/27 12:56:02 $
  1307.    * $Author: jsp $
  1308.    */ 
  1309.   
  1310. --- 1,7 ----
  1311.   /* 
  1312.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/show.c,v $
  1313. !  * $Revision: 7.3 $
  1314. !  * $Date: 92/02/04 12:21:46 $
  1315.    * $Author: jsp $
  1316.    */ 
  1317.   
  1318. *** ../work/token.c    Tue Feb  4 12:28:09 1992
  1319. --- token.c    Tue Feb  4 12:24:14 1992
  1320. ***************
  1321. *** 1,7 ****
  1322.   /* 
  1323.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/token.c,v $
  1324. !  * $Revision: 7.2 $
  1325. !  * $Date: 92/01/27 12:56:06 $
  1326.    * $Author: jsp $
  1327.    */
  1328.   
  1329. --- 1,7 ----
  1330.   /* 
  1331.    * $Source: /n/fs/vd/jsp/src/jgraph/RCS/token.c,v $
  1332. !  * $Revision: 7.3 $
  1333. !  * $Date: 92/02/04 12:21:47 $
  1334.    * $Author: jsp $
  1335.    */
  1336.   
  1337.  
  1338. exit 0 # Just in case...
  1339.