[comp.sources.misc] v10i010: Calctool V2.4 - a simple calculator

richb@Aus.Sun.COM (Rich Burridge) (01/16/90)

Posting-number: Volume 10, Issue 10
Submitted-by: richb@Aus.Sun.COM (Rich Burridge)
Archive-name: calctool24/part05

---- Cut Here and unpack ----
#!/bin/sh
# this is part 5 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file x11.c continued
#
CurArch=5
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file x11.c"
sed 's/^X//' << 'SHAR_EOF' >> x11.c
X           
X  load_colors() ;
X  if (iscolor) calctool_icon = load_icon(cicon_image) ;
X  else calctool_icon = load_icon(icon_image) ;
X
X  size.flags = PMinSize | PMaxSize | PPosition | PSize ;
X  size.x = 0 ;
X  size.y = 0 ;
X  size.max_width = size.min_width = size.width = TWIDTH ;
X  size.max_height = size.min_height = size.height = THEIGHT + DISPLAY ;
X
X  if (strlen(geometry))
X    {
X      flags = XParseGeometry(geometry, &x, &y, &w, &h) ;
X      if (XValue & flags)
X        {
X          if (XNegative & flags)
X            x = DisplayWidth(dpy, screen) + x - size.width ;
X            size.flags |= USPosition ;
X            size.x = x ;
X        }
X      if (YValue & flags)
X        {
X          if (YNegative & flags)
X            y = DisplayHeight(dpy, screen) + y - size.height ;
X            size.flags |= USPosition ;
X            size.y = y ;
X        }      
X    }
X
X  frame = XCreateSimpleWindow(dpy, RootWindow(dpy, screen),
X                              size.x, size.y, size.width, size.height,
X                              CALCTOOL_BORDER_WIDTH, foregnd, backgnd) ;
X
X  rframe = XCreateSimpleWindow(dpy, RootWindow(dpy, screen),
X                               size.x + TWIDTH + 15, size.y,
X                               size.width, 200,
X                               CALCTOOL_BORDER_WIDTH, foregnd, backgnd) ;
X
X  protocol_atom = XInternAtom(dpy, "WM_PROTOCOLS", False) ;
X  kill_atom = XInternAtom(dpy, "WM_DELETE_WINDOW", False) ;
X
X  XSetStandardProperties(dpy, frame, "calctool", NULL, calctool_icon,
X                         argv, argc, &size) ;
X
X  wm_hints.icon_x = ix ;
X  wm_hints.icon_y = iy ;
X  wm_hints.input = True ;
X  wm_hints.icon_pixmap = calctool_icon ;
X  wm_hints.flags = IconPositionHint | InputHint | IconPixmapHint ;
X  if (iconic)
X    {
X      wm_hints.initial_state = IconicState ;
X      wm_hints.flags |= StateHint ;
X    }
X  XSetWMHints(dpy, frame, &wm_hints) ;
X
X  gc_mask = GCFont | GCForeground | GCBackground | GCGraphicsExposures ;
X  gc_val.font = nfont->fid ;
X  gc_val.foreground = foregnd ;
X  gc_val.background = backgnd ;
X  gc_val.graphics_exposures = False ;
X  gc = XCreateGC(dpy, RootWindow(dpy, screen), gc_mask, &gc_val) ;
X  XSetFunction(dpy, gc, GXcopy) ;
X
X  main_cursor = XCreateFontCursor(dpy, XC_top_left_arrow) ;
X  FGcolor.red = FGcolor.green = FGcolor.blue = 0 ;
X  BGcolor.red = BGcolor.green = BGcolor.blue = 0xffff ;
X  help_cursor = load_cursor(help_cursor_array) ;
X}
X
X
Xmake_icon() {}        /* Null routine - icon created in make_frame. */
X
X
Xmake_items()
X{
X  XSelectInput(dpy, frame, FRAME_MASK) ;
X  XMapWindow(dpy, frame) ;
X
X  XSelectInput(dpy, rframe, ExposureMask) ;
X}
X
X
Xmake_subframes() {}          /* Null routine, see the make_frame routine. */
X
X
Xprocess_expose(event)
XXExposeEvent *event ;
X{
X  int doframe, dorframe ;
X
X  doframe = dorframe = 0 ;
X  do
X    {
X      if (event->count == 0)
X        {
X               if (event->window == frame) doframe++ ;
X          else if (event->window == rframe) dorframe++ ;
X        }
X    }
X  while (XCheckMaskEvent(dpy, ExposureMask, event)) ;
X 
X  if (dorframe && rstate) make_registers() ;
X  if (doframe) return(CFRAME_REPAINT) ;
X}
X
X
Xset_cursor(type)
Xint type ;
X{
X  switch (type)
X    {
X      case HELPCURSOR : XDefineCursor(dpy, frame, help_cursor) ;
X                        break ;
X      case MAINCURSOR : XDefineCursor(dpy, frame, main_cursor) ;
X    }
X}
X
X
Xstart_tool()
X{
X  while (1)
X    process_event(get_next_event()) ;
X}
X
X
Xtoggle_reg_canvas()
X{
X  rstate = !rstate ;
X  if (rstate) XMapWindow(dpy, rframe) ;
X  else XUnmapWindow(dpy, rframe) ;
X}
SHAR_EOF
echo "File x11.c is complete"
chmod 0444 x11.c || echo "restore of x11.c fails"
set `wc -c x11.c`;Sum=$1
if test "$Sum" != "13680"
then echo original size 13680, current size $Sum;fi
echo "x - extracting xview.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > xview.c &&
X
X/*  @(#)xview.c 1.11 89/12/21
X *
X *  These are the XView dependent graphics routines used by calctool.
X *
X *  Copyright (c) Rich Burridge.
X *                Sun Microsystems, Australia - All rights reserved.
X *
X *  Permission is given to distribute these sources, as long as the
X *  copyright messages are not removed, and no monies are exchanged.
X *
X *  No responsibility is taken for any errors or inaccuracies inherent
X *  either to the comments or the code of this program, but if
X *  reported to me then an attempt will be made to fix them.
X */
X
X#include "calctool.h"
X#include "color.h"
X#include "extern.h"
X#include <xview/xview.h>
X#include <xview/canvas.h>
X#include <xview/cms.h>
X#include <xview/cursor.h>
X#include <xview/sel_svc.h>
X#include <xview/sel_attrs.h>
X
X#define  MENU_SET                       (void) menu_set
X#define  NOTIFY_DO_DISPATCH             (void) notify_do_dispatch
X#define  NOTIFY_INTERPOSE_DESTROY_FUNC  (void) notify_interpose_destroy_func
X#define  PW_SETCMSNAME                  (void) pw_setcmsname
X#define  PW_PUTCOLORMAP                 (void) pw_putcolormap
X#define  PW_TTEXT                       (void) pw_ttext
X#define  PW_WRITEBACKGROUND             (void) pw_writebackground
X#define  SELN_QUERY                     (void) seln_query
X#define  XV_SET                         (void) xv_set
X#define  WINDOW_DONE                    (void) window_done
X
X#define  SMALLFONT   "/usr/lib/fonts/fixedwidthfonts/screen.r.7"
X#define  NORMALFONT  "/usr/lib/fonts/fixedwidthfonts/screen.b.14"
X#define  BIGFONT     "/usr/lib/fonts/fixedwidthfonts/gallant.r.19"
X
Xvoid func_key_proc() ;
Xint menu_proc() ;
X
XCanvas kcanvas, rcanvas ;
XEvent *cur_event ;
XFrame frame, rframe ;
XIcon calctool_icon ;
XMenu menus[MAXMENUS] ;
XNotify_value destroy_proc() ;
XPixfont *bfont, *font, *nfont, *sfont, *xv_pf_default(), *xv_pf_open() ;
XCanvas_paint_window pw, cpw, rcpw ;
XSeln_client sel_client ;
XSeln_holder holder ;
XSeln_rank rank = SELN_PRIMARY ;
XSeln_result get_proc(), reply_proc() ;
XXv_cmsdata cms_data ;
XXv_Cursor help_cursor, main_cursor ;
X
Xchar colorname[CMS_NAMESIZE] ;
Xu_char red[CALC_COLORSIZE], green[CALC_COLORSIZE], blue[CALC_COLORSIZE] ;
X
Xenum menu_type curmenu ;   /* Current menu (if any) being processed. */
Xint started ;              /* Set just before window is displayed. */
X
Xshort help_cursor_array[16] = {
X#include "help.cursor"
X} ;
Xmpr_static(help_cursor_pr, 16, 16, 1, help_cursor_array) ;
X
Xunsigned short icon_image[] = {
X#include "calctool.icon"
X} ;
Xmpr_static(icon_pr, 64, 64, 1, icon_image) ;
X
Xshort cicon_image[] = {
X#include "calctool.color.icon"
X} ;
Xmpr_static(cicon_pr, 64, 64, 8, cicon_image) ;
X
X
X/*ARGSUSED*/
Xvoid
Xcanvas_event_proc(canvas, event, arg)
XCanvas canvas ;
XEvent *event ;
Xcaddr_t arg ;
X{
X  if (!started) return ;
X  cur_event = event ;
X  process_event(get_next_event(event)) ;
X}
X
X
Xclear_canvas(window, color)
Xenum can_type window ;
Xint color ;
X{
X  int height,width ;
X  Canvas ctype ;
X
X  if (window == KEYCANVAS)
X    {
X      pw = cpw ;
X      ctype = frame ;
X    } 
X  else if (window == REGCANVAS)
X    {
X      pw = rcpw ;
X      ctype = rframe ;
X    }
X  height = (int) xv_get(ctype, XV_HEIGHT) ;
X  width = (int) xv_get(ctype, XV_WIDTH) ;
X  PW_WRITEBACKGROUND(pw, 0, 0, width, height, PIX_SRC | PIX_COLOR(color)) ;
X}
X
X
Xclose_frame()
X{
X  if ((int) xv_get(rframe, XV_SHOW) == TRUE)
X    XV_SET(rframe, XV_SHOW, FALSE, 0) ;
X  XV_SET(frame, FRAME_CLOSED, TRUE, 0) ;
X  rstate = 0 ;
X}
X
X
Xcolor_area(x, y, width, height, color)
Xint x, y, width, height, color ;
X{
X  PW_WRITEBACKGROUND(cpw, x, y, width, height, PIX_SRC | PIX_COLOR(color)) ;
X}
X
X
Xcreate_menu(mtype)    /* Create popup menu for right button press. */
Xenum menu_type mtype ;
X{
X  int i ;
X
X  menus[(int) mtype] = xv_create(XV_NULL, MENU_COMMAND_MENU,
X                                 MENU_NOTIFY_PROC, menu_proc,
X                                 MENU_FONT, nfont,
X                                 0) ;
X  for (i = 0; i < MAXREGS; i++)
X    {
X      switch (mtype)
X        {
X          case M_ACC    :                              /* Accuracies. */
X          case M_EXCH   :                              /* Register exchange. */
X          case M_LSHIFT :                              /* Left shift. */
X          case M_RCL    :                              /* Register recall. */
X          case M_RSHIFT :                              /* Right shift. */
X          case M_STO    : MENU_SET(menus[(int) mtype], /* Register store. */
X                                   MENU_STRING_ITEM, num_names[i], i+1,
X                                   0) ;
X                          break ;
X          case M_CON    : if (strlen(con_names[i]))    /* Constants. */
X                            MENU_SET(menus[(int) mtype],
X                                     MENU_STRING_ITEM, con_names[i], i+1,
X                                     0) ;
X                          break ;
X          case M_FUN    : if (strlen(fun_names[i]))    /* Functions. */
X                            MENU_SET(menus[(int) mtype],
X                                     MENU_STRING_ITEM, fun_names[i], i+1,
X                                     0) ;
X        }
X    }
X}
X
X
Xdestroy_frame()
X{
X  WINDOW_DONE(frame) ;
X  exit(0) ;
X}
X
X
Xdestroy_rframe(frame)
XFrame frame ;
X{
X  rstate = 0 ;
X  XV_SET(frame, XV_SHOW, FALSE, 0) ;
X}
X
X
X/*ARGSUSED*/
XNotify_value
Xdestroy_proc(client, status)
XNotify_client client ;
XDestroy_status status ;
X{
X  exit(0) ;
X}
X
X
X/*  This routine works rather strangely. Because menu_show does not block
X *  under XView, do_menu cannot return a valid selection. So the menu
X *  selection handling has been moved to the notification procedure, and
X *  the appropriate code in graphics.c has been isolated into a separate
X *  routine. All in all, a bit of a kludge.
X */
X
Xdo_menu(mtype)      /* Popup appropriate menu. */
Xenum menu_type mtype ;
X{
X  curmenu =  mtype ;
X  menu_show(menus[(int) mtype], kcanvas, cur_event, 0) ;
X  return(0) ;
X}
X
X
Xdrawline(x1, y1, x2, y2)
Xint x1, y1, x2, y2 ;
X{
X  (void) pw_vector(cpw, x1, y1, x2, y2, PIX_SET, 0) ;
X}
X
X
Xdraw_regs()
X{
X  make_registers() ;
X  XV_SET(rframe, XV_SHOW, TRUE, 0) ;
X}
X
X
Xdrawtext(x, y, window, fontno, color, str)
Xenum font_type fontno ;
Xenum can_type window ;
Xint x, y, color ;
Xchar *str ;
X{
X       if (fontno == SFONT) font = sfont ;
X  else if (fontno == NFONT) font = nfont ;
X  else if (fontno == BFONT) font = bfont ;
X       if (window == KEYCANVAS) pw = cpw ;
X  else if (window == REGCANVAS) pw = rcpw ;
X
X  if (color == BLACK)
X    (void) pw_text(pw, x, y, PIX_SRC | PIX_DST, font, str) ;
X  else if (color == WHITE)
X    PW_TTEXT(pw, x, y, PIX_SRC | PIX_COLOR(color), font, str) ;
X}
X
X
X/*ARGSUSED*/
Xvoid
Xfunc_key_proc(client_data, args)
Xchar *client_data ;
XSeln_function_buffer *args ;
X{
X  get_display() ;
X}
X
X
Xget_display()     /* The GET function key has been pressed. */
X{
X  if (seln_acquire(sel_client, SELN_SHELF) == SELN_SHELF)
X    {
X      if (shelf != NULL) free(shelf) ;
X      shelf = malloc((unsigned) strlen(display)) ;
X      STRCPY(shelf, display) ;         /* Safely keep copy of display. */
X    }
X}
X
X
XPixfont *
Xget_font(name)
Xchar *name ;
X{
X  Pixfont *font ;
X
X  font = xv_pf_open(name) ;
X  if (font == NULL) font = xv_pf_default() ;
X  if (font == NULL)
X    {
X      perror("couldn't get the default font.") ;
X      exit(1) ;
X    }
X  return font ;
X}
X
X
Xget_next_event(event)
XEvent *event ;
X{
X  static char eb[4] ;      /* Event buffer. */
X  int i ;
X
X#ifdef   SUN4_KEYBOARD
X  char *rpad = "\000\000\000=/*789456123" ;
X  char *akeys = "8264" ;
X  char *sun4keys = "\000\000\000+-\000\0000\000." ;
X#else
X  char *rpad = "\000\000\00078945612301=" ;
X  char *akeys = "5.31" ;
X#endif /*SUN4_KEYBOARD*/
X 
X  nextc = event_id(event) ;
X  curx = event_x(event) ;
X  cury = event_y(event) ;
X
X  if (event_is_button(event))
X         if (event_is_down(event) && nextc == MS_LEFT) return(LEFT_DOWN) ;
X    else if (event_is_down(event) && nextc == MS_MIDDLE) return(MIDDLE_DOWN) ;
X    else if (event_is_down(event) && nextc == MS_RIGHT) return(RIGHT_DOWN) ;
X    else if (event_is_up(event) && nextc == MS_LEFT) return(LEFT_UP) ;
X    else if (event_is_up(event) && nextc == MS_MIDDLE) return(MIDDLE_UP) ;
X    else if (event_is_up(event) && nextc == MS_RIGHT) return(RIGHT_UP) ;
X
X/*  The following code attempts to handle a numeric keypad using the right
X *  function keys. This pad differs on the Sun3 and Sun4 keyboards. There
X *  is a compile-time define which determines which keyboard setup is
X *  looked for.
X */
X 
X  if (event_is_ascii(event) && event_is_down(event))
X    {
X   
X/*  If the last two events were escape and left square bracket.. */
X   
X      if (eb[0] && eb[1])
X        {
X          switch (nextc)
X            {
X   
X/*  Interpret the arrow keys (if they are set).
X *  R8 = ^[A     R14 = ^[B     R12 = ^[C     R10 = ^[B
X */
X   
X              case 'A' :
X              case 'B' :
X              case 'C' :
X              case 'D' : cur_ch = akeys[nextc - 'A'] ;
X                         eb[0] = eb[1] = '\0' ;
X                         return(KEYBOARD) ;
X   
X/*  Interpret the extra keys found on Sun4 keyboards.
X *  These have codes of the form: ^[<int>z where <int> is a number
X *  between 247 and 255.  We're only interested in 4 of these keys.
X *  These are:
X *    ^[253z = +     ^[254z = -     ^[257z = 0     ^[259z = .
X */
X#ifdef SUN4_KEYBOARD
X              case '2' : eb[2] = '2' ;
X                         break ;
X
X              case '5' : if (eb[0] && eb[1] && eb[2])
X                           {
X                             eb[3] = '5' ;
X                             break ;
X                           }
X                         else
X
X/*  Clear event_buf and treat as normal ascii char. */
X
X                           {
X                             eb[0] = eb[1] = '\0' ;
X                             cur_ch = nextc ;
X                             return(KEYBOARD) ;
X                           }
X
X              case '3' :
X              case '4' :
X              case '7' :
X              case '9' : if (eb[0] && eb[1] && eb[2] && eb[3])
X                           {
X                             cur_ch = sun4keys[nextc - '0'] ;
X                             eb[0] = eb[1] = eb[2] = eb[3] = '\0' ;
X                             return(KEYBOARD) ;
X                           }
X                         else if (eb[0] && eb[1] && eb[2] && nextc == '4')
X                           {
X                             eb[3] = nextc ;
X                             break ;
X                           }
X                         else
X
X/*  Clear event_buf and treat as normal ascii char. */
X
X                           {
X                             eb[0] = eb[1] = '\0' ;
X                             cur_ch = nextc ;
X                             return(KEYBOARD) ;
X                           }
X#endif /*SUN4_KEYBOARD*/
X
X               default : eb[0] = eb[1] = eb[2] = eb[3] = '\0' ;
X            }
X        }    
X
X/*  If previous events are ^[[ : set buffer   */
X
X      else if (nextc == '[' && eb[0])    /* Check for left square bracket. */
X        eb[1] = '[' ;
X      else if (nextc == '\033')          /* Check for escape char. */
X        eb[0] = '\033' ;
X      else
X        {
X
X/*  All the rest of the ASCII characters. */
X                              
X          eb[0] = eb[1] = '\0' ;
X          cur_ch = nextc ;    
X          return(KEYBOARD) ;
X        }                     
X    }                         
X                            
X  if (event_is_key_right(event) && event_is_up(event))
X    {
X      for (i = 1; i < 16; i++)
X        if (nextc == KEY_RIGHT(i))
X          {                 
X            cur_ch = rpad[i-1] ;
X            return(KEYBOARD) ;
X          }                   
X    }
X
X  if (nextc == KBD_DONE && down) return(EXIT_WINDOW) ;
X  if (nextc == LOC_WINEXIT) return(EXIT_WINDOW) ;
X  if (nextc == LOC_WINENTER) return(ENTER_WINDOW) ;
X
X  if (nextc == WIN_RESIZE) return(CFRAME_REPAINT) ;
X  if (nextc == WIN_REPAINT) return(CFRAME_REPAINT) ;
X
X  if ((nextc == KEY_LEFT(6)) & event_is_up(event)) return(PUT_ON_SHELF) ;
X  if ((nextc == KEY_LEFT(8)) && event_is_up(event)) return(TAKE_FROM_SHELF) ;
X  return(LASTEVENTPLUSONE) ;
X}
X
X
XSeln_result
Xget_proc(buffer)
XSeln_request *buffer ;
X{
X  issel = 0 ;
X  if (*buffer->requester.context == 0)
X    {
X      if (buffer == (Seln_request *) NULL ||
X          *((Seln_attribute *) buffer->data) != SELN_REQ_CONTENTS_ASCII)
X        return ;
X      selection = buffer->data + sizeof(Seln_attribute) ;
X      *buffer->requester.context = 1 ;
X    }
X  else selection = buffer->data ;
X  issel = 1 ;
X}
X
X
Xhandle_selection()  /* Handle the GET function key being pressed. */
X{
X  char context = 0 ;
X
X  holder = seln_inquire(rank) ;
X  if (holder.state == SELN_NONE) return ;
X  SELN_QUERY(&holder, get_proc, &context, SELN_REQ_CONTENTS_ASCII, 0, 0) ;
X}
X
X
Xinit_fonts()
X{
X  bfont = get_font(BIGFONT) ;
X  nfont = get_font(NORMALFONT) ;
X  nfont_width = nfont->pf_defaultsize.x ;
X  sfont = get_font(SMALLFONT) ;
X}
X
X
Xinit_ws_type()
X{
X  gtype = XVIEW ;
X  started = 0 ;               /* Kludge to correctly handle repaints. */
X  return 0 ;
X}
X
X
Xload_colors()      /* Create and load color map - done in make_subframes. */
X{
X}
X
X
Xmake_frames(argc, argv)
Xint argc ;
Xchar *argv[] ;
X{
X  int x, y ;
X
X  xv_init(XV_INIT_ARGS, argc, argv, 0) ;
X  frame = xv_create(0, FRAME,
X                    FRAME_ICON,        calctool_icon,
X                    FRAME_SHOW_LABEL,  FALSE,
X                    FRAME_NO_CONFIRM,  TRUE,
X                    XV_WIDTH,          TWIDTH,
X                    XV_HEIGHT,         THEIGHT + DISPLAY,
X                    0) ;
X  iscolor = ((int) xv_get(frame, WIN_DEPTH) > 1) ? 1 : 0 ;
X  sel_client = seln_create(func_key_proc, reply_proc, (char *) 0) ;
X  NOTIFY_INTERPOSE_DESTROY_FUNC(frame, destroy_proc) ;
X  rframe = xv_create(frame, FRAME,
X                     FRAME_SHOW_LABEL, FALSE,
X                     FRAME_NO_CONFIRM, TRUE,
X                     FRAME_DONE_PROC,  destroy_rframe,
X                     XV_X,             TWIDTH + 15,
X                     XV_Y,             0,
X                     XV_SHOW,          FALSE,
X                     XV_WIDTH,         TWIDTH,
X                     XV_HEIGHT,        200,
X                     XV_FONT,          nfont,
X                     0) ;
X 
X}
X
X
Xmake_icon()
X{
X  calctool_icon = xv_create(0, ICON,
X                            XV_WIDTH,   ICONWIDTH,
X                            ICON_IMAGE, &icon_pr,
X                            0) ;
X}
X
X
Xmake_items()
X{
X  main_cursor = xv_get(kcanvas, WIN_CURSOR) ;
X
X  if (iscolor)
X    {
X      calctool_icon = (Icon) xv_get(frame, FRAME_ICON) ;
X      XV_SET(calctool_icon,
X             ICON_IMAGE, &cicon_pr,
X             WIN_CMS_NAME, colorname,
X             0) ;
X      XV_SET(frame, FRAME_ICON, calctool_icon, 0) ;
X    }
X
X  help_cursor = xv_create(NULL, CURSOR,
X                          CURSOR_XHOT,  0,
X                          CURSOR_YHOT,  0,
X                          CURSOR_OP,    PIX_SRC | PIX_DST,
X                          CURSOR_IMAGE, &help_cursor_pr,
X                          0) ;
X}
X
X
Xmake_subframes()
X{
X  rcanvas = xv_create(rframe, CANVAS, 0) ;
X
X  SPRINTF(colorname, "%s%D", CALC_COLOR, getpid()) ;
X  calc_colorsetup(red, green, blue) ;
X
X  cms_data.type = XV_STATIC_CMS ;
X  cms_data.size = CALC_COLORSIZE ;
X  cms_data.rgb_count = CALC_COLORSIZE ;
X  cms_data.index = 0 ;
X  cms_data.red = red ;
X  cms_data.green = green ;
X  cms_data.blue = blue ;
X
X  kcanvas = xv_create(frame, CANVAS,
X                      CANVAS_RETAINED,     FALSE,
X                      OPENWIN_AUTO_CLEAR,  FALSE,
X                      XV_WIDTH,            TWIDTH,
X                      XV_HEIGHT,           THEIGHT + DISPLAY,
X                      XV_FONT,             nfont,
X                      CANVAS_PAINTWINDOW_ATTRS,
X                          WIN_CMS_NAME, colorname,
X                          WIN_CMS_DATA, &cms_data,
X                          WIN_CONSUME_EVENTS,
X                            MS_LEFT, MS_MIDDLE, MS_RIGHT,
X                            WIN_ASCII_EVENTS, KBD_USE, KBD_DONE,
X                            LOC_WINENTER, LOC_WINEXIT,
X                            WIN_LEFT_KEYS, WIN_TOP_KEYS, WIN_RIGHT_KEYS,
X                            0,
X                          WIN_IGNORE_EVENTS,
X                            LOC_MOVE, LOC_DRAG,
X                            0,
X                          WIN_EVENT_PROC, canvas_event_proc,
X                          0,
X                      0) ;
X
X  rcpw = canvas_paint_window(rcanvas) ;
X  cpw = canvas_paint_window(kcanvas) ;
X}
X
X
Xmenu_proc(menu, menu_item)
XMenu menu ;
XMenu_item menu_item ;
X{
X  int choice ;
X
X  choice = (int) menu_get(menu_item, MENU_VALUE) ;
X  if (choice) handle_menu_selection(curmenu, choice) ;
X}
X
X
X/*ARGSUSED*/
XSeln_result
Xreply_proc(item, context, length)
XSeln_attribute item ;
XSeln_replier_data *context ;
Xint length ;
X{
X  int size ;
X  char *destp ;
X
X  switch (item)
X    {
X      case SELN_REQ_CONTENTS_ASCII :
X
X             if (context->context == NULL)
X               {
X                 if (shelf == NULL) return(SELN_DIDNT_HAVE) ;
X                 context->context = shelf ;
X               }
X             size = strlen(context->context) ;
X             destp = (char *) context->response_pointer ;
X             STRCPY(destp, context->context) ;
X             destp += size ;
X             while ((int) destp % 4 != 0) *destp++ = '\0' ;
X             context->response_pointer = (char **) destp ;
X             *context->response_pointer++ = 0 ;
X             return(SELN_SUCCESS) ;
X
X      case SELN_REQ_YIELD :
X
X             *context->response_pointer++ = (char *) SELN_SUCCESS ;
X             return(SELN_SUCCESS) ;
X
X      case SELN_REQ_BYTESIZE :
X
X             if (shelf == NULL) return(SELN_DIDNT_HAVE) ;
X             *context->response_pointer++ = (char *) strlen(shelf) ;
X             return(SELN_SUCCESS) ;
X
X      case SELN_REQ_END_REQUEST : return(SELN_SUCCESS) ;
X
X      default                   : return(SELN_UNRECOGNIZED) ;
X    }
X}
X
X
Xset_cursor(type)
Xint type ;
X{
X  switch (type)
X    {
X      case HELPCURSOR : XV_SET(kcanvas, WIN_CURSOR, help_cursor, 0) ;
X                        break ;
X      case MAINCURSOR : XV_SET(kcanvas, WIN_CURSOR, main_cursor, 0) ;
X    }
X}
X
X
Xstart_tool()
X{
X  started = 1 ;
X  xv_main_loop(frame) ;
X}
X
X
Xtoggle_reg_canvas()
X{
X  rstate = !rstate ;
X  if (rstate) draw_regs() ;
X  else XV_SET(rframe, XV_SHOW, FALSE, 0) ;
X}
SHAR_EOF
chmod 0444 xview.c || echo "restore of xview.c fails"
set `wc -c xview.c`;Sum=$1
if test "$Sum" != "18237"
then echo original size 18237, current size $Sum;fi
echo "x - extracting calctool.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > calctool.h &&
X
X/*  @(#)calctool.h 1.10 89/11/06
X *
X *  Contains all the global definitions used by calctool.
X *
X *  Copyright (c) Rich Burridge.
X *                Sun Microsystems, Australia - All rights reserved.
X *
X *  Permission is given to distribute these sources, as long as the
X *  copyright messages are not removed, and no monies are exchanged.
X *
X *  No responsibility is taken for any errors or inaccuracies inherent
X *  either to the comments or the code of this program, but if
X *  reported to me then an attempt will be made to fix them.
X */
X
X#include <stdio.h>
X#include <strings.h>
X#include <ctype.h>
X#include <signal.h>
X#include <sys/types.h>
X#include <sys/ioctl.h>
X#include <sys/time.h>
X#include <pwd.h>
X#include <math.h>
X
Xchar *getenv(), *sprintf() ;
X
X#define  CLOSE          (void) close      /* To make lint happy. */
X#define  FCLOSE         (void) fclose
X#define  FFLUSH         (void) fflush
X#define  FGETS          (void) fgets
X#define  FPRINTF        (void) fprintf
X#define  IOCTL          (void) ioctl
X#define  PUTC           (void) putc
X#define  READ           (void) read
X#define  SELECT         (void) select
X#define  SIGNAL         (void) signal
X#define  SPRINTF        (void) sprintf
X#define  SSCANF         (void) sscanf
X#define  STRCAT         (void) strcat
X#define  STRCPY         (void) strcpy
X#define  STRNCAT        (void) strncat
X#define  STRNCPY        (void) strncpy
X#define  WRITE          (void) write
X
X/* Various pseudo events used by the calctool program. */
X#define  CFRAME_REPAINT   100    /* Main frame needs repainting. */
X#define  RFRAME_REPAINT   101    /* Register frame needs repainting. */
X#define  ENTER_WINDOW     102    /* Mouse has enter calctool window. */
X#define  EXIT_WINDOW      103    /* Mouse has exited calctool window. */ 
X#define  KEYBOARD         104    /* Keyboard character was pressed. */
X#define  LEFT_DOWN        105    /* Left mouse button was depressed. */
X#define  LEFT_UP          106    /* Left mouse button was debounced. */
X#define  MIDDLE_DOWN      107    /* Middle mouse button was depressed. */
X#define  MIDDLE_UP        108    /* Middle mouse button was debounced. */
X#define  RIGHT_DOWN       109    /* Right mouse button was depressed. */
X#define  RIGHT_UP         110    /* Right mouse button was debounced. */
X#define  TAKE_FROM_SHELF  111    /* PUT function key was pressed. */
X#define  PUT_ON_SHELF     112    /* GET function key was pressed. */
X#define  DIED             113    /* Calctool window has been destroyed. */
X#define  LASTEVENTPLUSONE 114    /* Not one of the above. */
X
X#define  HELPCURSOR     0      /* Cursor types. */
X#define  MAINCURSOR     1
X
Xenum base_type { BIN, OCT, DEC, HEX } ;      /* Base definitions. */
X
Xenum but_state { NORMAL, INVERTED } ;        /* Calculator button states. */
X 
Xenum can_type { KEYCANVAS, REGCANVAS, PANELCANVAS } ;  /* Canvas types. */
X
Xenum font_type { SFONT, NFONT, BFONT } ;     /* Text font definitions. */
X
X/* Graphics supported. */
Xenum gr_type  { MGR, NEWS, SVIEW, TTY, X11, XVIEW } ;
X
X/* Pseudo panel items. */
Xenum item_type { BASEITEM, DISPLAYITEM, TTYPEITEM, NUMITEM,
X                 HYPITEM,  INVITEM,     OPITEM } ;
X
X/* Popup menu types. Used with some of the graphics versions. */
Xenum menu_type {
X       M_ACC,    M_CON,   M_EXCH,   M_FUN,
X       M_LSHIFT, M_RCL,   M_RSHIFT, M_STO
X} ;
X
Xenum num_type { FIX, SCI } ;                 /* Number display mode. */
X
Xenum op_type { OP_SET, OP_CLEAR, OP_NOP } ;  /* Operation item settings. */
X
Xenum trig_type { DEG, GRAD, RAD } ;          /* Trigonometric types. */
X
X#define  BBORDER        10     /* No of pixels in border. */
X#define  BCOLS          6      /* No of columns of buttons. */
X#define  BGAP           5      /* No of pixels between buttons. */
X#define  BHEIGHT        52     /* Number of pixels for height. */
X#define  BROWS          6      /* No of rows of buttons. */
X#define  BWIDTH         44     /* No of pixels for width. */
X
X#define  CCTRL(n)       n - 96     /* Generate control character value. */
X#define  DISPLAY        30         /* Calculators numerical display. */
X
X#define  EQUAL          !strcmp    /* For character comparisons. */
X#define  EXTRA          5          /* Extra useful character definitions. */
X
X#ifndef  HELPGIVEN
X#define  HELPNAME       "calctool.help"
X#endif /*HELPGIVEN*/
X
X#define  ICONHEIGHT     64         /* Height of calctool icon. */
X#define  ICONWIDTH      42         /* Width of calctool icon. */
X#define  INC            argc-- ; argv++ ;
X#define  MAX_DIGITS     32         /* Maximum displayable number of digits. */
X#define  MAXITEMS       7          /* Maximum number of panel items. */
X
X#ifndef  MAXLINE
X#define  MAXLINE        256        /* Length of character strings. */
X#endif /*MAXLINE*/
X
X#define  MAXMENUS       8          /* Maximum number of popup menus. */
X#define  MAXREGS        10         /* Maximum number of memory registers. */
X#define  MAXVKEYS       7          /* Number of valid keys after an error. */
X#define  MIN(x,y)       ((x) < (y) ? (x) : (y))
X
X#ifndef  NEWSGIVEN
X#define  NEWSNAME       "calctool.ps"
X#endif /*NEWSGIVEN*/
X
X#define  NOBUTTONS      BROWS * BCOLS
X
X#ifndef  RCGIVEN
X#define  RCNAME         ".calctoolrc"
X#endif /*RCGIVEN*/
X
X#ifndef  NO_4_3SIGNAL
X#define  SIGRET         void
X#else
X#define  SIGRET         int
X#endif /*NO_4_3SIGNAL*/
X
X#define  THEIGHT        (BROWS*BHEIGHT) + ((BROWS-1) * BGAP) + (2*BBORDER)
X#define  TITEMS         NOBUTTONS*2 + EXTRA    /* Total definitions. */
X#define  TWIDTH         (BCOLS*BWIDTH) + ((BCOLS-1) * BGAP) + (2*BBORDER)
X
Xtypedef  unsigned long  BOOLEAN ;
X
Xstruct iteminfo                  /* Panel item information record. */
X  {
X    enum font_type font ;        /* Font type for this panel item. */
X    int x ;                      /* X position of item. */
X    int y ;                      /* Y position of item. */
X    char text[60] ;              /* Text string associated with this item. */
X  } ;
X
Xstruct button {
X         char *str ;             /* Button display string. */
X         char value ;            /* Unique button keyboard equivalent. */
X         enum op_type opdisp ;   /* Display operation code during operation. */
X         char color ;            /* Color of button portion. */
X         int  (*func)() ;        /* Function to obey on button press. */
X} ;
SHAR_EOF
chmod 0444 calctool.h || echo "restore of calctool.h fails"
set `wc -c calctool.h`;Sum=$1
if test "$Sum" != "6292"
then echo original size 6292, current size $Sum;fi
echo "x - extracting color.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > color.h &&
X
X/*  @(#)color.h 1.1 89/03/21
X *
X *  Colormap definitions used by calctool.
X *
X *  Copyright (c) Rich Burridge.
X *               Sun Microsystems, Australia - All rights reserved.
X *
X *  Permission is given to distribute these sources, as long as the
X *  copyright messages are not removed, and no monies are exchanged.
X *
X *  No responsibility is taken for any errors or inaccuracies inherent
X *  either to the comments or the code of this program, but if
X *  reported to me then an attempt will be made to fix them.
X */
X
X#define  CALC_COLOR      "calcolor"
X#define  CALC_COLORSIZE  16
X
X#define  WHITE    0
X#define  RED      1
X#define  ORANGE   2
X#define  YELLOW   3
X#define  LGREEN   4
X#define  BLUE     5
X#define  MAUVE    6
X#define  GREEN    7
X#define  PINK     8
X#define  LBLUE    9
X#define  GREY     10
X#define  LGREY    11
X#define  LPURPLE  12
X#define  BLACK    13
X#define  SPARE14  14
X#define  SPARE15  15
X
X#define calc_colorsetup(r,g,b) \
X        (r)[WHITE] = 255 ;       (g)[WHITE] = 255 ;       (b)[WHITE] = 255 ; \
X        (r)[RED] = 255 ;         (g)[RED] = 50 ;          (b)[RED] = 0 ; \
X        (r)[ORANGE] = 255 ;      (g)[ORANGE] = 128 ;      (b)[ORANGE] = 0 ; \
X        (r)[YELLOW] = 255 ;      (g)[YELLOW] = 255 ;      (b)[YELLOW] = 0 ; \
X        (r)[LGREEN] = 128 ;      (g)[LGREEN] = 255 ;      (b)[LGREEN] = 128 ; \
X        (r)[BLUE] = 50 ;         (g)[BLUE] = 128 ;        (b)[BLUE] = 255 ; \
X        (r)[MAUVE] = 128 ;       (g)[MAUVE] = 128 ;       (b)[MAUVE] = 255 ; \
X        (r)[GREEN] = 0 ;         (g)[GREEN] = 158 ;       (b)[GREEN] = 158 ; \
X        (r)[PINK] = 255 ;        (g)[PINK] = 192 ;        (b)[PINK] = 192 ; \
X        (r)[LBLUE] = 50 ;        (g)[LBLUE] = 178 ;       (b)[LBLUE] = 255 ; \
X        (r)[GREY] = 128 ;        (g)[GREY] = 128 ;        (b)[GREY] = 128 ; \
X        (r)[LGREY] = 200 ;       (g)[LGREY] = 200 ;       (b)[LGREY] = 200 ; \
X        (r)[LPURPLE] = 225 ;     (g)[LPURPLE] = 225 ;     (b)[LPURPLE] = 255 ; \
X        (r)[BLACK] = 0 ;         (g)[BLACK] = 0 ;         (b)[BLACK] = 0 ; \
X        (r)[SPARE14] = 0 ;       (g)[SPARE14] = 0 ;       (b)[SPARE14] = 0 ; \
X        (r)[SPARE15] = 0 ;       (g)[SPARE15] = 0 ;       (b)[SPARE15] = 0 ;
SHAR_EOF
chmod 0444 color.h || echo "restore of color.h fails"
set `wc -c color.h`;Sum=$1
if test "$Sum" != "2202"
then echo original size 2202, current size $Sum;fi
echo "x - extracting extern.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > extern.h &&
X
X/*  @(#)extern.h 1.9 89/11/01
X *
X *  Contains the external variable definitions used by calctool.
X *
X *  Copyright (c) Rich Burridge.
X *                Sun Microsystems, Australia - All rights reserved.
X *
X *  Permission is given to distribute these sources, as long as the
X *  copyright messages are not removed, and no monies are exchanged.
X *
X *  No responsibility is taken for any errors or inaccuracies inherent
X *  either to the comments or the code of this program, but if
X *  reported to me then an attempt will be made to fix them.
X */
X
Xextern char *make_fixed(), *make_number(), *make_scientific() ;
Xextern char base_str[4][4] ;               /* Strings for each base value. */
Xextern char con_names[MAXREGS][MAXLINE] ;  /* .calctoolrc constant names. */
Xextern char cur_op ;            /* Current arithmetic operation. */
Xextern char current ;           /* Current button or character pressed. */
Xextern char digits[] ;          /* Valid numerical digits. */
Xextern char display[] ;         /* Current calculator display. */
Xextern char dtype_str[2][4] ;   /* Strings for each display mode value. */
Xextern char *exp_posn ;         /* Position of the exponent sign. */
Xextern char fnum[] ;            /* Scratch area for fixed point numbers. */
Xextern char fun_names[MAXREGS][MAXLINE] ; /* .calctoolrc function names. */
Xextern char fun_vals[MAXREGS][MAXLINE] ;  /* .calctoolrc function defs. */
Xextern char geometry[] ;        /* X11 geometry information. */
Xextern char helpname[] ;        /* Filename for helpfile. */
Xextern char num_names[MAXREGS][2] ;       /* Used by the popup menus. */
Xextern char old_cal_value ;     /* Previous calculation operator. */
Xextern char progname[] ;        /* Name of this program. */
Xextern char pstr[] ;            /* Current button text string. */
Xextern char revtable[] ;        /* Table for reversing the bits in a byte. */
Xextern char *selection ;        /* Current [Get] selection. */
Xextern char *shelf ;            /* PUT selection shelf contents. */
Xextern char snum[] ;            /* Scratch are for scientific numbers. */
Xextern char ttype_str[3][5] ;   /* Strings for each trig type value. */
Xextern char validkeys[] ;       /* Valid keys after an error condition. */
Xextern char validmenu[] ;       /* Valid keys with popup menus. */
Xextern char x11_display[] ;     /* X11 display information. */
X
Xextern double convert_display() ;
Xextern double con_vals[] ;        /* Selectable constants. */
Xextern double disp_val ;           /* Value of the current display. */
Xextern double exp_p1[10][4] ;
Xextern double last_input ;         /* Previous number input by user. */
Xextern double max_fix[] ;          /* Maximum showable fixed values. */
Xextern double mem_vals[] ;         /* Memory register values. */
Xextern double powers[11][4] ;      /* Table of power values for each base. */
Xextern double result ;             /* Current calculator total value. */
Xextern double tresults[] ;         /* Current trigonometric results. */
X
Xextern enum base_type base ;       /* Current base: BIN, OCT, DEC or HEX. */
Xextern enum gr_type gtype ;        /* What graphics system is being used. */
Xextern enum num_type dtype ;       /* Number display mode. */
Xextern enum trig_type ttype ;      /* Trigonometric type (deg, grad or rad). */
X
Xextern int accuracy ;       /* Number of digits precision (Max 9). */
Xextern int basevals[] ;     /* Supported arithmetic bases. */
Xextern int chxoff[] ;       /* X offset for various length button strings. */
Xextern int color ;          /* Color used for current raster operation. */
Xextern int column ;         /* Column number of current key/mouse press. */
Xextern int cur_ch ;         /* Current character if keyboard event. */
Xextern int curx ;           /* Current mouse X position. */
Xextern int cury ;           /* Current mouse Y position. */
Xextern int disp_length[] ;  /* Display length in characters for each base. */
Xextern int down ;           /* Indicates if mouse button is down. */
Xextern int error ;          /* Indicates some kind of display error. */
Xextern int hyperbolic ;     /* If set, trig functions will be hyperbolic. */
Xextern int iconic ;         /* Set if window is currently iconic. */
Xextern int inv_video ;      /* Set if user wants inverse video mode. */
Xextern int inverse ;        /* If set, trig & log functions will be inversed. */
Xextern int iscolor ;        /* Set if this is a color screen. */
Xextern int ishelp ;         /* Set if there is a help file. */
Xextern int issel ;          /* Set if valid [Get] selection. */
Xextern int ix ;             /* Initial X position of the icon. */
Xextern int iy ;             /* Initial Y position of the icon. */
Xextern int key_exp ;        /* Set if entering exponent number. */
Xextern int new_input ;      /* New number input since last op. */
Xextern int nextc ;          /* Current event identifier. */
Xextern int nfont_width ;    /* Width of the normal font characters. */
Xextern int pending ;        /* Set for command with on multiple presses. */
Xextern int pending_op ;     /* Arithmetic operation for pending command. */
Xextern int pointed ;        /* Whether a decimal point has been given. */
Xextern int portion ;        /* Button portion on current key/mouse press. */
Xextern int posspec ;        /* Set if -Wp or -g option is present (for X11) */
Xextern int row ;            /* Row number of current key/mouse press. */
Xextern int rstate ;         /* Is memory register frame displayed? */
Xextern int signgam ;
Xextern int spaces ;         /* Number of spaces in current button string. */
Xextern int toclear ;        /* Indicates if display should be cleared. */
Xextern int tstate ;         /* Current button set being displayed. */
Xextern int wx ;             /* Initial X position of the window. */
Xextern int wy ;             /* Initial Y position of the window. */
Xextern int x ;              /* X offset for text for button. */
Xextern int y ;              /* Y offset for text for button. */
X
Xextern FILE *hfd ;          /* File descriptor for help information. */
X
Xextern struct iteminfo items[] ;  /* Panel items. */
Xextern struct button buttons[] ;  /* Calculator button values. */
SHAR_EOF
chmod 0444 extern.h || echo "restore of extern.h fails"
set `wc -c extern.h`;Sum=$1
if test "$Sum" != "6171"
then echo original size 6171, current size $Sum;fi
echo "x - extracting calctool.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > calctool.icon &&
X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
X */
X	0x9555,0x5555,0x5540,0x0000,0xAAAA,0xAAAA,0xAA80,0x0000,
X	0x5555,0x5555,0x5540,0x0000,0xFFFF,0xFFFF,0xFE80,0x0000,
X	0x8000,0x0000,0x0340,0x0000,0xBFFF,0xFFFF,0xFA80,0x0000,
X	0xA000,0x0000,0x0B40,0x0000,0xA000,0x0000,0x0A80,0x0000,
X	0xA003,0x0030,0xCB40,0x0000,0xA004,0x8049,0x2A80,0x0000,
X	0xA005,0x8059,0x6B40,0x0000,0xA006,0x8069,0xAA80,0x0000,
X	0xA004,0x8449,0x2B40,0x0000,0xA003,0x0430,0xCA80,0x0000,
X	0xA000,0x0000,0x0B40,0x0000,0xA000,0x0000,0x0A80,0x0000,
X	0xBFFF,0xFFFF,0xFB40,0x0000,0x8000,0x0000,0x0280,0x0000,
X	0x8000,0x0000,0x0340,0x0000,0xBFDF,0xEFF7,0xFA80,0x0000,
X	0xA050,0x2814,0x0B40,0x0000,0xAF53,0x2994,0x0A80,0x0000,
X	0xA154,0xAA55,0x1340,0x0000,0xA253,0x2A54,0xAA80,0x0000,
X	0xA254,0xA9D4,0x4B40,0x0000,0xA454,0xA854,0xAA80,0x0000,
X	0xA453,0x2995,0x1B40,0x0000,0xA050,0x2814,0x0A80,0x0000,
X	0xBFDF,0xEFF7,0xFB40,0x0000,0x8000,0x0000,0x0280,0x0000,
X	0xBFDF,0xEFF7,0xFB40,0x0000,0xA050,0x2814,0x0A80,0x0000,
X	0xA257,0xA994,0x2B40,0x0000,0xA654,0x2A14,0x4A80,0x0000,
X	0xAA57,0x2B94,0x4B40,0x0000,0xAF50,0xAA54,0x8A80,0x0000,
X	0xA254,0xAA54,0x8B40,0x0000,0xA253,0x2995,0x0A80,0x0000,
X	0xA050,0x2814,0x0B40,0x0000,0xBFDF,0xEFF7,0xFA80,0x0000,
X	0x8000,0x0000,0x0340,0x0000,0xBFDF,0xEFF7,0xFA80,0x0000,
X	0xA050,0x2814,0x0B40,0x0000,0xA253,0x2994,0x0A80,0x0000,
X	0xA654,0xAA54,0x0B40,0x0000,0xA250,0xA895,0xEA80,0x0000,
X	0xA253,0x2854,0x0B40,0x0000,0xA254,0x2A54,0x0A80,0x0000,
X	0xA757,0xA994,0x0B40,0x0000,0xA050,0x2814,0x0A80,0x0000,
X	0xBFDF,0xEFF7,0xFB40,0x0000,0x8000,0x0000,0x0280,0x0000,
X	0xBFDF,0xEFF7,0xFB40,0x0000,0xA050,0x2814,0x0A80,0x0000,
X	0xA650,0x2814,0x0B40,0x0000,0xA950,0x2814,0x4A80,0x0000,
X	0xAB50,0x2BD4,0x4B40,0x0000,0xAD50,0x2815,0xFA80,0x0000,
X	0xA951,0x2BD4,0x4B40,0x0000,0xA651,0x2814,0x4A80,0x0000,
X	0xA050,0x2814,0x0B40,0x0000,0xBFDF,0xEFF7,0xFA80,0x0000,
X	0x8000,0x0000,0x0300,0x0000,0xFFFF,0xFFFF,0xFE00,0x0000
SHAR_EOF
chmod 0444 calctool.icon || echo "restore of calctool.icon fails"
set `wc -c calctool.icon`;Sum=$1
if test "$Sum" != "1933"
then echo original size 1933, current size $Sum;fi
echo "x - extracting calctool.color.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > calctool.color.icon &&
X/* Format_version=1, Width=64, Height=64, Depth=8, Valid_bits_per_item=16
X */
X	0x0d00,0x000d,0x0a0d,0x0a0d,0x0a0d,0x0a0d,0x0a0d,0x0a0d,
X	0x0a0d,0x0a0d,0x0a0d,0x0a0d,0x0a0d,0x0a0d,0x0a0d,0x0a0d,
X	0x0a0d,0x0a0d,0x0a0d,0x0a0d,0x0a0d,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0d00,0x0d0a,0x0d0a,0x0d0a,0x0d0a,0x0d0a,0x0d0a,0x0d0a,
X	0x0d0a,0x0d0a,0x0d0a,0x0d0a,0x0d0a,0x0d0a,0x0d0a,0x0d0a,
X	0x0d0a,0x0d0a,0x0d0a,0x0d0a,0x0d0a,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x000d,0x0a0d,0x0a0d,0x0a0d,0x0a0d,0x0a0d,0x0a0d,0x0a0d,
X	0x0a0d,0x0a0d,0x0a0d,0x0a0d,0x0a0d,0x0a0d,0x0a0d,0x0a0d,
X	0x0a0d,0x0a0d,0x0a0d,0x0a0d,0x0a0d,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0d0d,0x0d0d,0x0d0d,0x0d0d,0x0d0d,0x0d0d,0x0d0d,0x0d0d,
X	0x0d0d,0x0d0d,0x0d0d,0x0d0d,0x0d0d,0x0d0d,0x0d0d,0x0d0d,
X	0x0d0d,0x0d0d,0x0d0d,0x0d0a,0x0d0a,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0d0b,0x0b0b,0x0b0b,0x0b0b,0x0b0b,0x0b0b,0x0b0b,0x0b0b,
X	0x0b0b,0x0b0b,0x0b0b,0x0b0b,0x0b0b,0x0b0b,0x0b0b,0x0b0b,
X	0x0b0b,0x0b0b,0x0b0b,0x0d0d,0x0a0d,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0d0b,0x0d0d,0x0d0d,0x0d0d,0x0d0d,0x0d0d,0x0d0d,0x0d0d,
X	0x0d0d,0x0d0d,0x0d0d,0x0d0d,0x0d0d,0x0d0d,0x0d0d,0x0d0d,
X	0x0d0d,0x0d0d,0x0d0b,0x0d0a,0x0d0a,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0d0b,0x0d00,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0d0b,0x0d0d,0x0a0d,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0d0b,0x0d00,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0d0b,0x0d0a,0x0d0a,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0d0b,0x0d00,0x0000,0x0000,0x0000,0x0000,0x0000,0x0d0d,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0d0d,0x0000,0x0000,
X	0x0d0d,0x0000,0x0d0b,0x0d0d,0x0a0d,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0d0b,0x0d00,0x0000,0x0000,0x0000,0x0000,0x000d,0x0000,
X	0x0d00,0x0000,0x0000,0x0000,0x000d,0x0000,0x0d00,0x000d,
X	0x0000,0x0d00,0x0d0b,0x0d0a,0x0d0a,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0d0b,0x0d00,0x0000,0x0000,0x0000,0x0000,0x000d,0x000d,
X	0x0d00,0x0000,0x0000,0x0000,0x000d,0x000d,0x0d00,0x000d,
X	0x000d,0x0d00,0x0d0b,0x0d0d,0x0a0d,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0d0b,0x0d00,0x0000,0x0000,0x0000,0x0000,0x000d,0x0d00,
X	0x0d00,0x0000,0x0000,0x0000,0x000d,0x0d00,0x0d00,0x000d,
X	0x0d00,0x0d00,0x0d0b,0x0d0a,0x0d0a,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0d0b,0x0d00,0x0000,0x0000,0x0000,0x0000,0x000d,0x0000,
X	0x0d00,0x0000,0x000d,0x0000,0x000d,0x0000,0x0d00,0x000d,
X	0x0000,0x0d00,0x0d0b,0x0d0d,0x0a0d,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0d0b,0x0d00,0x0000,0x0000,0x0000,0x0000,0x0000,0x0d0d,
X	0x0000,0x0000,0x000d,0x0000,0x0000,0x0d0d,0x0000,0x0000,
X	0x0d0d,0x0000,0x0d0b,0x0d0a,0x0d0a,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0d0b,0x0d00,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
X	0x0000,0x0000,0x0d0b,0x0d0d,0x0a0d,0x0000,0x0000,0x0000,
SHAR_EOF
echo "End of part 5"
echo "File calctool.color.icon is continued in part 6"
echo "6" > s2_seq_.tmp
exit 0