/* to be included subroutines file mylib.h */
int anvil()
   {
   /* draw a sapphire anvil */
   newpath();
   moveto(0,0);
   rlineto(0,0.5,0.5,0.5,0.5,0,0.5,-0.5,0,-0.5);
   stroke();
   }
 
int screw(double len)
   {
   int i,j;
   /* draw a screw using a loop for */
   /* the threads */
   newpath();
   moveto(0,0);
   rlineto(0.25,0,0,0.25,-0.5,0,0,-0.25);
   closepath();
   moveto(0.15,0);
   rlineto(0,-len,-0.3,0,0,len);
   moveto(-0.15,0);
   j = (int) (len / 0.2);
   for (i=0;i < j;i++)
      {
      rmoveto(0.3,0);
      rlineto(-0.30,-0.20);
      }
   stroke();
   }
 
int heater()
   {
   int i;
   /* draw a heater using a loop */
   /* for the windings */
   double y = 0;
   newpath();
   moveto(0,0);
   for (i=0;i < 5;i++)
      {
      moveto(0.1,y);
      arcn(0,y,0.1,360,0);
      y = y + 0.4;
      }
   stroke();
   }

int slit()
   {
   /* draw a spectrometer slit */
   newpath();
   moveto(0,0);
   rlineto(0,1.5,0.25,0,0,-1.25);
   closepath();
   stroke();
   }

int driver()
   {
   /* draw long screw drivers */
   newpath();
   moveto(0,0);
   rlineto(0.15,0,0,0.25,0.1,0,0,10.8);
   moveto(0,0);
   rlineto(-0.15,0,0,0.25,-0.1,0,0,10.8);
   stroke();
   }

int white_box(double x1,double y1,double x2,double y2)
   { 
   /* draw a white filled box for */
   /* white out purposes. The parametrs */
   /* passed in are the box corners */
   newpath();
   box(x1,y1,x2,y2);
   gsave();
   set(LINECOLOUR,WHITE);
   fill();
   grestore();
   }

int lens()
   {
   /* draw a spherical lens using arcs */
   newpath();
   arcn(0,-4,4,110,70);
   arcn(0,3.45,4,290,250);
   closepath();
   stroke();
   }

int prism()
   {
   /* draw a prism */
   newpath();
   moveto(0,0.5);
   rlineto(0,-0.5,0.5,0);
   closepath();
   stroke();
   }

int tail()
   {
   /* draw the dewar tail */
   set(LINECOLOUR,BLACK);
   moveto(2.44,30);
   lineto(2.44,6.33,7.77,6.33,7.77,30);
   stroke();
   /* draw windows */
   set(LINECOLOUR,BROWN);
   white_box(2.29,12.30,2.59,9.41);
   stroke();
   white_box(7.62,12.30,7.92,9.41);
   stroke();
   }
 
