home *** CD-ROM | disk | FTP | other *** search
/ The UNIX CD Bookshelf / OREILLY_TUCB_UNIX_CD.iso / upt / examples / SOURCES / IPL / RTR / IPL. next >
Encoding:
Text File  |  1998-07-24  |  21.6 KB  |  701 lines

  1. *** install.h.orig    Mon Oct 26 14:19:02 1992
  2. --- install.h    Mon Oct 26 14:19:01 1992
  3. ***************
  4. *** 0 ****
  5. --- 1,8 ----
  6. + #define INSTALL_TMP "/usr/tmp"
  7. + #define PATHNAME_LEN 80
  8. + #define HBUFSIZ 4096
  9. + #define MAX_D_ROWS 1000
  10. + #define MAX_D_COLS 24
  11. + #define DATAITEM_LEN 20
  12. + #define TEMPLATE_PATH "<installsharedir>/<prefix>lib/ipl/tplates"
  13. + #define MONTHSTUB_PATH "<installsharedir>/<prefix>lib/ipl/tplates/month.stubs"
  14. *** src/util.c.orig    Mon Oct 26 16:09:19 1992
  15. --- src/util.c    Mon Oct 26 16:17:38 1992
  16. ***************
  17. *** 1,6 ****
  18.   #include "gdp.x"
  19.   
  20. ! extern char *getlogin();
  21.   
  22.   /* ============== */
  23.   /* save_spec() can be called to save current proc specification in file s. */
  24. --- 1,19 ----
  25.   #include "gdp.x"
  26.   
  27. ! char *username()
  28. ! {
  29. ! #include <sys/types.h>
  30. ! #include <pwd.h>
  31. !   register struct passwd *pw;
  32. !   register uid_t uid;
  33. !   uid = geteuid ();
  34. !   pw = getpwuid (uid);
  35. !   if (pw) return(pw->pw_name);
  36. !   return "Unknown";
  37. ! }
  38.   
  39.   /* ============== */
  40.   /* save_spec() can be called to save current proc specification in file s. */
  41. ***************
  42. *** 11,17 ****
  43.   FILE *fp;
  44.   int i;
  45.   
  46. ! sprintf( fnm, "%s/ipl%s%d.%s", TEMPDIR, getlogin(), getpid(), s );
  47.   fp = fopen( fnm, "w" );
  48.   if( fp == NULL ) { fprintf( stderr, "Can't w open inherit file %s.\n", fnm ); gdp_exit(); }
  49.   for( i = 0; i < Clines; i++ ) fprintf( fp, "%s", Chunk[i] );
  50. --- 24,30 ----
  51.   FILE *fp;
  52.   int i;
  53.   
  54. ! sprintf( fnm, "%s/ipl%s%d.%s", TEMPDIR, username(), getpid(), s );
  55.   fp = fopen( fnm, "w" );
  56.   if( fp == NULL ) { fprintf( stderr, "Can't w open inherit file %s.\n", fnm ); gdp_exit(); }
  57.   for( i = 0; i < Clines; i++ ) fprintf( fp, "%s", Chunk[i] );
  58. ***************
  59. *** 27,33 ****
  60.   FILE *fp;
  61.   
  62.   if( strlen( s ) < 1 ) { Ilines = 0; return( 1 ); }
  63. ! sprintf( fnm, "%s/ipl%s%d.%s", TEMPDIR, getlogin(), getpid(), s );
  64.   fp = fopen( fnm, "r" );
  65.   if( fp == NULL ) { fprintf( stderr, "Can't open inheritance file %s.\n", fnm ); gdp_exit(); }
  66.   Ilines = 0;
  67. --- 40,46 ----
  68.   FILE *fp;
  69.   
  70.   if( strlen( s ) < 1 ) { Ilines = 0; return( 1 ); }
  71. ! sprintf( fnm, "%s/ipl%s%d.%s", TEMPDIR, username(), getpid(), s );
  72.   fp = fopen( fnm, "r" );
  73.   if( fp == NULL ) { fprintf( stderr, "Can't open inheritance file %s.\n", fnm ); gdp_exit(); }
  74.   Ilines = 0;
  75. ***************
  76. *** 40,46 ****
  77.   gdp_exit()
  78.   {
  79.   char com[80];
  80. ! sprintf( com, "rm %s/ipl%s%d* 2> /dev/null", TEMPDIR, getlogin(), getpid() );
  81.   system( com );
  82.   proc_call( "Exit" );
  83.   exit();
  84. --- 53,59 ----
  85.   gdp_exit()
  86.   {
  87.   char com[80];
  88. ! sprintf( com, "rm %s/ipl%s%d* 2> /dev/null", TEMPDIR, username(), getpid() );
  89.   system( com );
  90.   proc_call( "Exit" );
  91.   exit();
  92. *** src/viplmenu.c.orig    Mon Oct 26 16:09:19 1992
  93. --- src/viplmenu.c    Mon Oct 26 16:16:37 1992
  94. ***************
  95. *** 23,37 ****
  96.   
  97.   
  98.   /* open holding file */
  99. ! sprintf( holdingfile, "%s/%siplhold%05d", INSTALL_TMP, getlogin(), getpid() );
  100.   hfp = fopen( holdingfile, "w" );
  101.   if( hfp == NULL ) { fprintf( stderr, "Cannot open holding file\n" ); gdp_exit(); }
  102.   
  103.   /* get dispfile name */
  104. ! sprintf( dispfile, "%s/%sipldisp%05d", INSTALL_TMP, getlogin(), getpid() );
  105.   
  106.   /* initialize ofp */
  107. ! sprintf( outfile, "%s/%siplout%05d", INSTALL_TMP, getlogin(), getpid() );
  108.   ofp = fopen( outfile, "w" );
  109.   if( ofp == NULL ) { fprintf( stderr, "Cannot open output file\n" ); gdp_exit(); }
  110.   fclose( ofp );
  111. --- 23,37 ----
  112.   
  113.   
  114.   /* open holding file */
  115. ! sprintf( holdingfile, "%s/%siplhold%05d", INSTALL_TMP, username(), getpid() );
  116.   hfp = fopen( holdingfile, "w" );
  117.   if( hfp == NULL ) { fprintf( stderr, "Cannot open holding file\n" ); gdp_exit(); }
  118.   
  119.   /* get dispfile name */
  120. ! sprintf( dispfile, "%s/%sipldisp%05d", INSTALL_TMP, username(), getpid() );
  121.   
  122.   /* initialize ofp */
  123. ! sprintf( outfile, "%s/%siplout%05d", INSTALL_TMP, username(), getpid() );
  124.   ofp = fopen( outfile, "w" );
  125.   if( ofp == NULL ) { fprintf( stderr, "Cannot open output file\n" ); gdp_exit(); }
  126.   fclose( ofp );
  127. *** src/initialize.c.orig    Mon Oct 26 16:20:53 1992
  128. --- src/initialize.c    Mon Oct 26 16:21:32 1992
  129. ***************
  130. *** 41,47 ****
  131.       Sfp = fopen( fnm, "r" );
  132.       }
  133.   
  134. ! if( Dev == 't' && Sfp == NULL ) { fprintf( stderr, "Control file not found.\n" ); exit(); }
  135.   
  136.   else if( Sfp == NULL ) {
  137.       NTinit( Dev );
  138. --- 41,47 ----
  139.       Sfp = fopen( fnm, "r" );
  140.       }
  141.   
  142. ! if( Dev == 't' && Sfp == NULL ) { fprintf( stderr, "Control file not found.\n" ); gdp_exit(); }
  143.   
  144.   else if( Sfp == NULL ) {
  145.       NTinit( Dev );
  146. ***************
  147. *** 56,62 ****
  148.   
  149.   DXlo = DXhi = 0; /* null out data dimensions */
  150.   DYlo = DYhi = 0;
  151. ! sprintf( Buf, "%s %s (%02d%02d%02d %02d:%02d)", getlogin(), (Argc>1)?Arg[1]:"", yr, mon, day, hr, min );
  152.   
  153.   strcpy( Stdfont, "/Helvetica" );
  154.   StdLw = 1.0;
  155. --- 56,62 ----
  156.   
  157.   DXlo = DXhi = 0; /* null out data dimensions */
  158.   DYlo = DYhi = 0;
  159. ! sprintf( Buf, "%s %s (%02d%02d%02d %02d:%02d)", username(), (Argc>1)?Arg[1]:"", yr, mon, day, hr, min );
  160.   
  161.   strcpy( Stdfont, "/Helvetica" );
  162.   StdLw = 1.0;
  163. *** src/Makefile.orig    Mon Oct 26 16:22:28 1992
  164. --- src/Makefile    Mon Oct 26 16:25:40 1992
  165. ***************
  166. *** 1,6 ****
  167. --- 1,7 ----
  168.   # Makefile for IPL source    1-21-90 scg
  169.   #
  170.   #
  171. + CC=gcc -DNOSUNVIEW
  172.   
  173.   IPL_OBJ = areadef.o areadress.o arrow.o bargraph.o boxplot.o \
  174.   distribution.o draw.o errorbars.o exit.o \
  175. ***************
  176. *** 15,36 ****
  177.   
  178.   GDP_OBJ = main.o gget.o constraint_check.o util.o
  179.   
  180. ! DRIVER_OBJ = sunv.o iplps.o pcode.o
  181.   
  182.   LIB_OBJ = lib.o 
  183.   
  184.   
  185.   # Use the following when Sunview is not available..
  186. ! # LIBES = -lm 
  187. ! # ipl: $(IPL_OBJ) $(GRAPHIC_OBJ) $(GDP_OBJ) $(PICK_OBJ) pcode.o iplps.o $(LIB_OBJ)
  188. ! #    cc $(IPL_OBJ) $(GRAPHIC_OBJ) $(GDP_OBJ) $(PICK_OBJ) $(DRIVER_OBJ) $(LIB_OBJ) \
  189. ! #      $(LIBES) -o ../bin/ipl
  190.   
  191.   # Use the following when Sunview is available..
  192. ! LIBES = -lm -lsuntool -lsunwindow -lpixrect
  193. ! ipl: $(IPL_OBJ) $(GRAPHIC_OBJ) $(GDP_OBJ) $(PICK_OBJ) $(DRIVER_OBJ) $(LIB_OBJ)
  194. !     cc $(IPL_OBJ) $(GRAPHIC_OBJ) $(GDP_OBJ) $(PICK_OBJ) $(DRIVER_OBJ) $(LIB_OBJ) \
  195. !       $(LIBES) -o ../bin/ipl
  196.   
  197.   $(GRPAHIC_OBJ) $(IPL_OBJ) $(GDP_OBJ) : ../install.h
  198.   $(GRAPHIC_OBJ) : graphic.h
  199. --- 16,37 ----
  200.   
  201.   GDP_OBJ = main.o gget.o constraint_check.o util.o
  202.   
  203. ! DRIVER_OBJ = iplps.o pcode.o
  204.   
  205.   LIB_OBJ = lib.o 
  206.   
  207.   
  208.   # Use the following when Sunview is not available..
  209. ! LIBES = -lm 
  210. ! ipl: $(IPL_OBJ) $(GRAPHIC_OBJ) $(GDP_OBJ) $(PICK_OBJ) pcode.o iplps.o $(LIB_OBJ)
  211. !     $(CC) $(IPL_OBJ) $(GRAPHIC_OBJ) $(GDP_OBJ) $(PICK_OBJ) $(DRIVER_OBJ) $(LIB_OBJ) \
  212. !       $(LIBES) -o ../bin/ipl
  213.   
  214.   # Use the following when Sunview is available..
  215. ! # LIBES = -lm -lsuntool -lsunwindow -lpixrect
  216. ! # ipl: $(IPL_OBJ) $(GRAPHIC_OBJ) $(GDP_OBJ) $(PICK_OBJ) $(DRIVER_OBJ) $(LIB_OBJ)
  217. ! #    cc $(IPL_OBJ) $(GRAPHIC_OBJ) $(GDP_OBJ) $(PICK_OBJ) $(DRIVER_OBJ) $(LIB_OBJ) \
  218. ! #      $(LIBES) -o ../bin/ipl
  219.   
  220.   $(GRPAHIC_OBJ) $(IPL_OBJ) $(GDP_OBJ) : ../install.h
  221.   $(GRAPHIC_OBJ) : graphic.h
  222. *** src/iplps.c.orig    Wed Dec  9 14:12:37 1992
  223. --- src/iplps.c    Fri Dec 11 09:11:42 1992
  224. ***************
  225. *** 55,60 ****
  226. --- 55,168 ----
  227.   /* set up standard line width */
  228.   printf(  "1 setlinewidth\n" );
  229.   
  230. + /* RTR changes to allow patterns as well as shading */
  231. + printf( "%% RTR changes to allow patterns as well as shading\n" );
  232. + printf( "%% pattern code is adapted from examples in PostSript Language\n" );
  233. + printf( "%% Tutorial and Cookbook\n\n" );
  234. + printf(  "/setuserscreendict 22 dict def\n");
  235. + printf(  "setuserscreendict begin\n" );
  236. + printf(  "  /tempctm matrix def\n" );
  237. + printf(  "  /temprot matrix def\n" );
  238. + printf(  "  /tempscale matrix def\n\n" );
  239. + printf(  " /concatprocs\n" );
  240. + printf(  " { /proc2 exch cvlit def\n" );
  241. + printf(  "   /proc1 exch cvlit def\n" );
  242. + printf(  "   /newproc proc1 length proc2 length add\n" );
  243. + printf(  "      array def\n" );
  244. + printf(  "   newproc 0 proc1 putinterval\n" );
  245. + printf(  "   newproc proc1 length proc2 putinterval\n" );
  246. + printf(  "   newproc cvx\n" );
  247. + printf(  " } def\n\n" );
  248. + printf(  "/resmatrix matrix def\n" );
  249. + printf(  "/findresolution\n" );
  250. + printf(  "{ 72 0 resmatrix defaultmatrix dtransform\n" );
  251. + printf(  "  /yres exch def /xres exch def\n" );
  252. + printf(  "  xres dup mul yres dup mul add sqrt\n" );
  253. + printf(  " } def\n" );
  254. + printf(  "end\n\n" );
  255. + printf(  "/setuserscreen\n" );
  256. + printf(  " { setuserscreendict begin\n" );
  257. + printf(  "   /spotfunction exch def\n" );
  258. + printf(  "   /screenangle exch def\n" );
  259. + printf(  "   /cellsize exch def\n" );
  260. + printf(  "   /m tempctm currentmatrix def\n" );
  261. + printf(  "   /rm screenangle temprot rotate def\n" );
  262. + printf(  "   /sm cellsize dup tempscale scale def\n\n" );
  263. + printf(  "   sm rm m m concatmatrix m concatmatrix pop\n" );
  264. + printf(  "   1 0 m dtransform /y1 exch def /x1 exch def\n" );
  265. + printf(  "   /veclength x1 dup mul y1 dup mul add sqrt def\n" );
  266. + printf(  "   /frequency findresolution veclength div def\n" );
  267. + printf(  "   /newscreenangle y1 x1 atan def\n\n" );
  268. + printf(  "   m 2 get m 1 get mul m 0 get m 3 get mul sub 0 gt\n\n" );
  269. + printf(  "  { { neg } /spotfunction load concatprocs\n" );
  270. + printf(  "        /spotfunction exch def\n" );
  271. + printf(  "  } if\n\n" );
  272. + printf(  "  frequency newscreenangle /spotfunction load\n" );
  273. + printf(  "    setscreen\n\n" );
  274. + printf(  "  end\n" );
  275. + printf(  "} def\n\n" );
  276. + printf(  "/setpatterndict 18 dict def\n" );
  277. + printf(  "setpatterndict begin\n" );
  278. + printf(  "  /bitison\n" );
  279. + printf(  "  { /ybit exch def /xbit exch def\n" );
  280. + printf(  "    /bytevalue bstring ybit bwidth mul xbit 8 idiv add get def\n" );
  281. + printf(  "    /mask 1 7 xbit 8 mod sub bitshift def\n" );
  282. + printf(  "    bytevalue mask and 0 ne\n" );
  283. + printf(  "  } def\n" );
  284. + printf(  "end\n\n" );
  285. + printf(  "/bitpatternspotfunction\n" );
  286. + printf(  " { setpatterndict begin\n" );
  287. + printf(  "   /y exch def /x exch def\n" );
  288. + printf(  "   /xindex x 1 add 2 div bpside mul cvi def\n" );
  289. + printf(  "   /yindex y 1 add 2 div bpside mul cvi def\n\n" );
  290. + printf(  "   xindex yindex bitison\n" );
  291. + printf(  "    {/onbits onbits 1 add def 1 }\n" );
  292. + printf(  "    {/offbits offbits 1 add def 0 }\n" );
  293. + printf(  "    ifelse\n" );
  294. + printf(  "  end\n" );
  295. + printf(  "} def\n\n" );
  296. + printf(  "/setpattern\n" );
  297. + printf(  " { setpatterndict begin\n" );
  298. + printf(  "   /cellsz exch def\n" );
  299. + printf(  "   /angle exch def\n" );
  300. + printf(  "   /bwidth exch def\n" );
  301. + printf(  "   /bpside exch def\n" );
  302. + printf(  "   /bstring exch def\n\n" );
  303. + printf(  "   /onbits 0 def /offbits 0 def\n" );
  304. + printf(  "   cellsz angle /bitpatternspotfunction load\n" );
  305. + printf(  "   setuserscreen\n" );
  306. + printf(  "   {} settransfer\n" );
  307. + printf(  "   offbits offbits onbits add div setgray\n" );
  308. + printf(  "   end\n" );
  309. + printf(  "} def\n\n" );
  310. + printf(  "/patterns [\n" );
  311. + printf(  " <ffffffffffffffff>\n" );
  312. + printf(  " <ffffffffffffffff>\n" );
  313. + printf(  " <ff7f3f1f0f070301>\n" );
  314. + printf(  " <1028448244281000>\n" );
  315. + printf(  " <ffffff0000000000> \n" );
  316. + printf(  " <e0e0e0e0e0e0e0e0> \n" );
  317. + printf(  " <0000183c3c180000>\n" );
  318. + printf(  " <8040201008040201>\n" );
  319. + printf(  " <0102040810204080>\n" );
  320. + printf(  " <1818ff818181ff18>\n" );
  321. + printf(  " <0000000000000000>\n" );
  322. + printf(  " <e0380e03030e38e0>\n" );
  323. + printf(  " <80808080808080ff>\n" );
  324. + printf(  " <8142241818244281>\n" );
  325. + printf(  " <d1e3c5885c3e1d88>\n" );
  326. + printf(  " <2e1c3a77a3c1e277>\n" );
  327. + printf(  "] def\n\n\n" );
  328. + printf(  "/setfillpattern\n" );
  329. + printf(  "{\n" );
  330. + printf(  "  /pat exch def\n\n" );
  331. + printf(  "  pat ceiling 1 le { pat setgray } \n" );
  332. + printf(  "                   { patterns pat ceiling cvi get\n" );
  333. + printf(  "                     8 1 0 72 300 32 div div setpattern }\n" );
  334. + printf(  "  ifelse\n\n" );
  335. + printf(  "} def\n\n" );
  336.   printf(  "%%%%EndProlog\n%%%%Page: ? 1\nsave\n" ); /* begin first page */
  337.   }
  338.   
  339. ***************
  340. *** 101,107 ****
  341.   PSshade( s )
  342.   double s;
  343.   {
  344. ! printf(  "closepath\n%3.2f setgray\nfill\n0 setgray\n", s );
  345.   }
  346.   
  347.   /* ============================== */
  348. --- 209,215 ----
  349.   PSshade( s )
  350.   double s;
  351.   {
  352. ! printf(  "closepath\n%3.2f setfillpattern\nfill\n0 setgray\n", s );
  353.   }
  354.   
  355.   /* ============================== */
  356. *** src/pcode.c.orig    Wed Dec  9 14:12:44 1992
  357. --- src/pcode.c    Fri Dec 11 09:32:29 1992
  358. ***************
  359. *** 110,121 ****
  360. --- 110,126 ----
  361.   sysdate( &mon, &day, &yr ); systime( &hr, &min, &sec );
  362.   
  363.   fprintf( stderr, "IPL graphics system version 1.0 by Steve Grubb\n" );
  364. + fprintf( stderr, "Pattern enhancements by Ready-to-Run Software, Inc\n" );
  365.   
  366.   /* initialize devices */
  367.   if( dev == 's' || dev == 'v' ) {  
  368. + #ifdef NOSUNVIEW
  369. +         fprintf( stderr, "pcode: no Sunview support\n"); exit();
  370. + #else
  371.       SVsetup( 11.0, 11.0 );
  372.       SVclear();
  373.       pdev = 's';
  374. + #endif
  375.       }
  376.   
  377.   else if( dev == 't' ) {
  378. --- src/rect.c.orig    Tue Aug 31 10:57:10 1993
  379. +++ src/rect.c    Tue Aug 31 15:43:18 1993
  380. @@ -43,3 +43,65 @@
  381.      NTlin( xlo, ylo );
  382.      }
  383.  }
  384. +/*  ab_rect_sh() - shadow rectangle in absolute space */
  385. +ab_rect_sh(xlo, ylo, xhi, yhi, shade, outline, offx, offy)
  386. +double xlo, ylo, xhi, yhi, shade, offx, offy;
  387. +int outline;
  388. +{
  389. +double tmpd;
  390. +
  391. +if((offx == 0.0) && (offy == 0.0))
  392. +    return;
  393. +if(yhi < ylo) {
  394. +    tmpd = yhi;
  395. +    yhi = ylo;
  396. +    ylo = tmpd;
  397. +}
  398. +ab_rect( xlo + offx, ylo + offy, xhi + offx, yhi + offy, shade, 0);
  399. +if ( outline ) {
  400. +    if(offx > 0.0) {
  401. +        NTmov(xhi + offx, ylo + offy);
  402. +        NTlin(xhi + offx, yhi + offy);
  403. +    }
  404. +    else {
  405. +               NTmov(xlo + offx, ylo + offy);
  406. +               NTlin(xlo + offx, yhi + offy);
  407. +    }
  408. +}
  409. +if( shade >= 0.0 ) {
  410. +        NTmov(xlo, ylo);
  411. +        NTpath(xlo + offx, ylo + offy);
  412. +        NTpath(xhi + offx, ylo + offy);
  413. +        NTpath(xhi, ylo);
  414. +    NTshade(shade);
  415. +}
  416. +if( outline) {
  417. +        NTmov(xlo, ylo);
  418. +        NTlin(xlo + offx, ylo + offy);
  419. +        if(offy < 0.0)
  420. +              NTlin(xhi + offx, ylo + offy);
  421. +        else
  422. +              NTmov(xhi + offx, ylo + offy);
  423. +        NTlin(xhi, ylo);
  424. +        NTlin(xlo, ylo);
  425. +}
  426. +if( shade >= 0.0) {
  427. +        NTmov(xlo, yhi);
  428. +        NTpath(xlo + offx, yhi + offy);
  429. +        NTpath(xhi + offx, yhi + offy);
  430. +        NTpath(xhi, yhi);
  431. +        NTshade(shade);
  432. +}
  433. +if( outline) {
  434. +        NTmov(xlo, yhi);
  435. +        NTlin(xlo + offx, yhi + offy);
  436. +        if(offy  > 0.0)
  437. +             NTlin(xhi + offx, yhi + offy);
  438. +        else
  439. +             NTmov(xhi + offx, yhi + offy);
  440. +        NTlin(xhi, yhi);
  441. +        NTlin(xlo, yhi);
  442. +}
  443. +}
  444. +
  445. +
  446. --- src/bargraph.c.orig    Tue Aug 31 10:56:57 1993
  447. +++ src/bargraph.c    Tue Aug 31 15:53:42 1993
  448. @@ -32,6 +32,7 @@
  449.      sep,
  450.      msep = 0.03;
  451.  char str[10];
  452. +double offx, offy;
  453.  
  454.  
  455.  /* get the data field list */
  456. @@ -82,6 +83,9 @@
  457.  /* x distance between major bar spaces */
  458.  gget( Buf, "Separation" ); sep = atof( Buf );
  459.  
  460. +gget( Buf, "Shadow" );
  461. +sscanf( Buf, "%lf %lf", &offx, &offy );
  462. +
  463.  gget( Buf, "Separation.sub" ); msep = atof( Buf );
  464.  
  465.  xspace = ( (Xhi-Xlo)/((DXhi-DXlo)+1) ) - (sep*Scale_x);
  466. @@ -122,12 +126,20 @@
  467.              continue;
  468.              }
  469.          y = atof(D[i-1][ k[j]-1 ]);
  470. -        if( y != DYlo )
  471. -            ab_rect( curx, da_y(zer), curx+(subspace-msep), da_y(y), s[j], (s[j]==1)?1:outline );
  472. +        if( y != DYlo ) {
  473. +            ab_rect_sh(curx, da_y(zer), curx + (subspace-msep), da_y(y), s[j], 
  474. +                           (s[j]==1)?1:outline, offx, offy);
  475. +            ab_rect( curx, da_y(zer), curx+(subspace-msep),
  476. +                                da_y(y), s[j], (s[j]==1)?1:outline );
  477. +
  478. +        }
  479.          if( label ) {
  480.              if( y < zer || format == STACK ) f = (-lblpos)-Chh; else f = lblpos;
  481.              strcpy( str, D[i-1][ idf[j]-1 ] );
  482. -            NTmov( curx, da_y(y)+f );
  483. +            if((offy > 0)  && (y > zer))
  484. +                                NTmov( curx + offx, da_y(y)+f+offy );
  485. +            else
  486. +                NTmov( curx, da_y(y)+f );
  487.              NTcentext( str, subspace-msep );
  488.              }
  489.          if( format == STACK ) for( jj = 1; jj < n; jj++ ) {
  490. @@ -136,11 +148,18 @@
  491.                  continue;
  492.                  }
  493.              y2 = y + atof( D[i-1][ k[jj] -1 ] );
  494. -            if( y2 != DYlo )
  495. -                ab_rect( curx, da_y(y), curx+(subspace-msep), da_y(y2), s[jj], (s[jj]==1)?1:outline );
  496. +            if( y2 != DYlo ) {
  497. +                                ab_rect_sh( curx, da_y(y), curx+(subspace-msep), da_y(y2), 
  498. +                    s[jj], (s[jj]==1)?1:outline, offx, offy );
  499. +                ab_rect( curx, da_y(y), curx+(subspace-msep), da_y(y2), 
  500. +                    s[jj], (s[jj]==1)?1:outline );
  501. +                    }
  502.              if( label ) {
  503.                  if( y2 < zer || format == STACK ) f = (-lblpos)-Chh; else f = lblpos;
  504. -                NTmov( curx, da_y(y2)+f );
  505. +                               if((offy > 0)  && (y2 > zer))
  506. +                                    NTmov( curx + offx, da_y(y2)+f+offy );
  507. +                            else
  508. +                                    NTmov( curx, da_y(y2)+f );
  509.                  strcpy( str, D[i-1][ idf[jj]-1 ] );
  510.                  NTcentext( str, subspace-msep );
  511.                  }
  512. @@ -152,7 +171,7 @@
  513.      }
  514.  
  515.  gget( Buf, "Segment" );
  516. -if( Buf[0] == 'y' ) 
  517. +if( (Buf[0] == 'y' ) && (offx == 0.0) && (offy == 0.0))
  518.      for( f = DYlo+DYtic; f < DYhi; f += DYtic ) 
  519.          rect( DXlo + 0.2, f-(DYhi*0.003), DXhi - 0.2, f+(DYhi*0.004), 1.0, 0 );
  520.  }
  521. --- src/template.h.orig    Tue Aug 31 10:57:11 1993
  522. +++ src/template.h    Tue Aug 31 16:06:38 1993
  523. @@ -73,6 +73,7 @@
  524.  "Idfield.position: -1 to 1 : 0.02  : distance of label above (or below) top of bar (inches)",
  525.  "Idfield.size:  charsize : 6  : char size of labels",
  526.  "Idfield: dfield (list8) :   : bars can be labeled using these field(s)",
  527. +"Shadow: coordpair : 0.0 0.0 : Offset of shadow, in absolute units." ,
  528.  "Killwild: number  :   : if a data value greater than this is found, abort ",
  529.  "Outlinebars: {y,n}  : y  : outline for each bar",
  530.  "Saveas:  token  :  : to save a set of parms for cloning",
  531. @@ -222,6 +223,7 @@
  532.  "Field: dfield (M) : : Data field to use.  Numbers should be integer percentages.",
  533.  "Center: coordpair : 4.0 5.5 : Location of center, in absolute units." ,
  534.  "Radius: 0 to 5 :  3 : Radius of pie, in absolute units.",
  535. +"Shadow: coordpair : 0.0 0.0 : Offset of shadow, in absolute units." ,
  536.  "Shade: color list20 : : Shades of pie sections",
  537.  "Linethick: 0 to 10 : 1 : Thickness of lines",
  538.  "Explode: 0 to 3 : 0.1 : Distance in abs units to 'explode' each piece",
  539. @@ -320,7 +322,7 @@
  540.  int Tdx[30] = { 0, 
  541.          64,  /* Areadef */
  542.          4,   /* Arrow */
  543. -        17,  /* Barg */
  544. +        18,  /* Barg */
  545.          11,  /* Boxp */
  546.          17,  /* Dist */
  547.          8,   /* Draw */ 
  548. @@ -332,7 +334,7 @@
  549.          11,  /* Nicetab */
  550.          11,  /* Page */
  551.          3,   /* Pagebreak */
  552. -        10,   /* Pie */
  553. +        11,   /* Pie */
  554.          6,   /* Point */
  555.          11,  /* Polygon */
  556.          3,   /* QuitAppend */
  557. --- src/pie.c.orig    Tue Aug 31 10:57:09 1993
  558. +++ src/pie.c    Tue Aug 31 16:17:38 1993
  559. @@ -5,6 +5,9 @@
  560.  int i, f, first, ns, explode;
  561.  double theta, val, stop;
  562.  double hx, hy, x, y, r;
  563. +double offx;
  564. +double offy;
  565. +double sh_hx, sh_hy;    /* shadow control */
  566.  double sh[20], lt;
  567.  double u, ux, uy, adj;
  568.  
  569. @@ -14,6 +17,9 @@
  570.  gget( Buf, "Center" );
  571.  sscanf( Buf, "%lf %lf", &hx, &hy );
  572.  
  573. +gget( Buf, "Shadow" );
  574. +sscanf( Buf, "%lf %lf", &offx, &offy );
  575. +
  576.  gget( Buf, "Radius" );
  577.  r = atof( Buf );
  578.  
  579. @@ -32,6 +38,52 @@
  580.    &sh[0],&sh[1],&sh[2],&sh[3],&sh[4],&sh[5],&sh[6],&sh[7],&sh[8],&sh[9],
  581.    &sh[10],&sh[11],&sh[12],&sh[13],&sh[14],&sh[15],&sh[16],&sh[17],&sh[18],&sh[19] );
  582.  
  583. +
  584. +/* do background and shadows */
  585. +if((offx != 0.0) || (offy != 0.0)) { 
  586. +    theta = adj * (3.1415927/180.0);
  587. +    for( i = 0; i < N_d_rows; i++ ) {
  588. +
  589. +            val = atof( D[i][f-1] );
  590. +
  591. +           /* convert val (percentage) to radians.. */
  592. +           val = ( val/100.0 ) * 6.28319;
  593. +           stop = theta + val;
  594. +           ux = u * cos( theta+(val/2.0) );
  595. +           uy = u * sin( theta+(val/2.0) );
  596. +
  597. +    sh_hx = hx + offx;
  598. +    sh_hy = hy + offy;
  599. +
  600. +    first = 1;
  601. +        for( ; theta < stop ; theta += 0.02 ) {
  602. +                x = sh_hx + (r * cos( theta ));
  603. +                y = sh_hy + (r * sin( theta ));
  604. +                if( first ) {
  605. +                       NTmov( x+ux, y+uy );
  606. +                       first = 0;
  607. +                    }
  608. +                NTlin( x+ux, y+uy );
  609. +                NTlin( x+ux - offx, y+uy - offy);
  610. +                NTlin( x+ux, y+uy);
  611. +
  612. +                }
  613. +        if (i < (N_d_rows - 1))
  614. +                theta = stop;
  615. +        else
  616. +                theta = adj * (3.1415927/180.0);
  617. +        x = sh_hx + (r * cos( theta ));
  618. +        y = sh_hy + (r * sin( theta ));
  619. +        NTlin( x+ux, y+uy );
  620. +
  621. +    NTlinetype( "0", 2.0*lt, 1.0 );
  622. +        NTmov( x+ux - offx, y+uy - offy);
  623. +        NTlin( x+ux, y+uy);
  624. +    NTlinetype( "0", lt, 1.0 );
  625. +        }
  626. +    NTshade( 0.5 );
  627. +}
  628. +
  629.  /* do shades */
  630.  theta = adj * (3.1415927/180.0) ;
  631.  for( i = 0; i < N_d_rows; i++ ) {
  632. @@ -45,15 +97,28 @@
  633.      uy = u * sin( theta+(val/2.0) );
  634.  
  635.      first = 1;
  636. -    for( ; theta < (stop+0.001); theta += 0.02 ) {
  637. +    for( ; theta < stop ; theta += 0.02 ) {
  638.          x = hx + (r * cos( theta ));
  639.          y = hy + (r * sin( theta ));
  640. -        if( first ) { NTmov( hx+ux, hy+uy ); NTpath( x+ux, y+uy ); first = 0; }
  641. +        if( first ) { 
  642. +                    if (N_d_rows != 1) {
  643. +                       NTmov( hx+ux, hy+uy ); 
  644. +        NTpath( x+ux, y+uy );
  645. +        }
  646. +                    else NTmov( x+ux, y+uy );
  647. +                    first = 0; 
  648. +                    }
  649.          NTpath( x+ux, y+uy );
  650.          }
  651. +        if (i < (N_d_rows - 1))
  652. +                theta = stop;
  653. +        else
  654. +                theta = adj * (3.1415927/180.0);
  655. +        x = hx + (r * cos( theta ));
  656. +        y = hy + (r * sin( theta ));
  657. +        NTpath( x+ux, y+uy );
  658.      if( i < ns )NTshade( sh[i] );
  659.      else NTshade( 1.0 );
  660. -    theta = stop;
  661.      }
  662.  
  663.  /* do lines */
  664. @@ -69,14 +134,27 @@
  665.      uy = u * sin( theta+(val/2.0) );
  666.  
  667.      first = 1;
  668. -    for( ; theta < (stop+0.001); theta += 0.02 ) {
  669. +    for( ; theta < stop ; theta += 0.02 ) {
  670.          x = hx + (r * cos( theta ));
  671.          y = hy + (r * sin( theta ));
  672. -        if( first ) { NTmov( hx+ux, hy+uy ); NTlin( x+ux, y+uy ); first = 0; }
  673. +        if( first ) { 
  674. +                    if (N_d_rows != 1) {
  675. +                       NTmov( hx+ux, hy+uy ); 
  676. +                       NTlin( x+ux, y+uy ); 
  677. +                       }
  678. +                    else NTmov( x+ux, y+uy );
  679. +                    first = 0; 
  680. +                    }
  681.          NTlin( x+ux, y+uy );
  682.          }
  683. -    NTlin( hx+ux, hy+uy );
  684. -    theta = stop;
  685. +    if (i < (N_d_rows - 1))
  686. +        theta = stop;
  687. +    else
  688. +        theta = adj * (3.1415927/180.0);
  689. +    x = hx + (r * cos( theta ));
  690. +    y = hy + (r * sin( theta ));
  691. +    NTlin( x+ux, y+uy );
  692. +    if (i > 1) NTlin( hx+ux, hy+uy );
  693.      }
  694.  
  695.  NTnormline();
  696.