home *** CD-ROM | disk | FTP | other *** search
- From: wht@n4hgf.Mt-Park.GA.US (Warren Tucker)
- Newsgroups: alt.sources
- Subject: X386MON part 06/06
- Message-ID: <326@n4hgf.Mt-Park.GA.US>
- Date: 16 Feb 91 19:36:32 GMT
-
- Submitted-by: wht@n4hgf
- Archive-name: x386monx100/part06
-
- #!/bin/sh
- # This is part 06 of x386monx100
- # ============= x386mon/x386mon.h ==============
- if test ! -d 'x386mon'; then
- echo 'x - creating directory x386mon'
- mkdir 'x386mon'
- fi
- if test -f 'x386mon/x386mon.h' -a X"$1" != X"-c"; then
- echo 'x - skipping x386mon/x386mon.h (File already exists)'
- else
- echo 'x - extracting x386mon/x386mon.h (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'x386mon/x386mon.h' &&
- X/*+-------------------------------------------------------------------------
- X x386mon.h - SCO ODT (UNIX 386) system watcher definitions
- X wht@n4hgf.Mt-Park.GA.US
- X--------------------------------------------------------------------------*/
- X/*+:EDITS:*/
- X/*:01-12-1991-04:35-wht@n4hgf-x1.00 (flush old edit notes) */
- X
- X#include <X11/Intrinsic.h>
- X#include "config.h"
- X
- Xchar *getenv();
- X
- Xtypedef struct myresources
- X{
- X char *geometry;
- X char *background;
- X char *foreground;
- X char *font;
- X int busyAlarmThreshhold;
- X int busyWarningThreshhold;
- X int breakAlarmThreshhold;
- X int breakWarningThreshhold;
- X int waitAlarmThreshhold;
- X int waitWarningThreshhold;
- X int swapAlarmThreshhold;
- X int swapWarningThreshhold;
- X} MyResources;
- X
- Xextern MyResources res;
- X
- Xtypedef struct myfontstruct
- X{
- X char *name;
- X int width;
- X int height;
- X int gap;
- X int win_height_threshhold;
- X Font fid;
- X XFontStruct *font_struct;
- X} MyFontStruct;
- Xextern MyFontStruct *currentMyFont;
- X
- X#define FASCENT (currentMyFont->font_struct->ascent)
- X#define FHEIGHT (currentMyFont->height)
- X#define FWIDTH (currentMyFont->width)
- X#define FGAP (currentMyFont->gap)
- X
- X#define BORDER_EXTRA_WIDTH (FGAP)
- X
- X#define MyButton_TLX 0
- X#define MyButton_TLY 1
- X
- X#define Tod_WIDTH (FWIDTH * 8)
- X#define Tod_TLX (DrawAreaXYWH.width - Tod_WIDTH - FGAP)
- X#define Tod_TLY 0
- X
- X#define StatPeriod_WIDTH (FWIDTH * 10)
- X#define StatPeriod_TLX (Tod_TLX - StatPeriod_WIDTH - (FWIDTH * 2))
- X#define StatPeriod_TLY 0
- X
- X#ifdef LABELLED_STAT_TIMES
- X#define StatPeriodL_WIDTH (FWIDTH * 7)
- X#else
- X#define StatPeriodL_WIDTH (FWIDTH * 0)
- X#endif
- X#define StatPeriodL_TLX (StatPeriod_TLX - StatPeriodL_WIDTH)
- X#define StatPeriodL_TLY 0
- X
- X#define StatCycle_WIDTH (FWIDTH * 7)
- X#define StatCycle_TLX (StatPeriodL_TLX - StatCycle_WIDTH - (FWIDTH * 2))
- X#define StatCycle_TLY 0
- X
- X#ifdef LABELLED_STAT_TIMES
- X#define StatCycleL_WIDTH (FWIDTH * 6)
- X#else
- X#define StatCycleL_WIDTH (FWIDTH * 0)
- X#endif
- X#define StatCycleL_TLX (StatCycle_TLX - StatCycleL_WIDTH)
- X#define StatCycleL_TLY 0
- X
- X#define CpuScale_TLX 0
- X#define CpuScale_TLY (FHEIGHT * 2)
- X
- X#define WaitScale_TLX 0
- X#define WaitScale_TLY (FHEIGHT * 6)
- X
- X/* Sysinfo/Minfo per second area */
- X#define Sysinfo_TLY (FHEIGHT * 10) /* absolute ... */
- X#define Sysinfo_TLX (FWIDTH * 0) /* ... positions */
- X#define Sysinfo1_TLX (FWIDTH * 0) /* offsets */
- X#define Sysinfo2_TLX (FWIDTH * 18)
- X#define Sysinfo3_TLX (FWIDTH * 35)
- X#define Sysinfo4_TLX (FWIDTH * 51)
- X#define Sysinfo5_TLX (FWIDTH * 66)
- X
- X/* extra info area */
- X#define EXTRA_TLY (FHEIGHT * 24) /* absolute ... */
- X#define EXTRA_TLX (FWIDTH * 0) /* ... positions */
- X#define EXTRA1_TLX (FWIDTH * 0) /* offsets */
- X#define EXTRA2_TLX (FWIDTH * 18)
- X#define EXTRA3_TLX (FWIDTH * 43)
- X#define EXTRA4_TLX (FWIDTH * 62)
- X
- X#define Var_TLX (EXTRA_TLX + EXTRA1_TLX)
- X#define Var_TLY EXTRA_TLY
- X
- X#define Bootinfo_TLX (EXTRA_TLX + EXTRA2_TLX)
- X#define Bootinfo_TLY EXTRA_TLY
- X
- X#define Tune_TLX (EXTRA_TLX + EXTRA3_TLX)
- X#define Tune_TLY EXTRA_TLY
- X
- X#define Proc_TLX (EXTRA_TLX + EXTRA4_TLX)
- X#define Proc_TLY EXTRA_TLY
- X
- X
- X#define MIN_PCT_SCALE_WIDTH 100
- X
- X/* 6 == 6x10, 20 == number of characters to left of pct scales */
- X/*
- X0000000000111111111122222222223333333333444444444455555555556666666666777777777
- X0123456789012345678901234567890123456789012345678901234567890123456789012345678
- X 1 93 100 000 000 uuuuuuuuuuuuuuuuuuuuuuuuuuukkkkkkkkkkkkkkkkkkk
- X 5 87 100 000 000 uuuuuuuuuuuuukkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
- X10 89 45 44 0 uuuuuuuuuuuuuuuuuuuuuukkkkkkkkkkkkkkkkkkkkkk
- X*/
- X#define DrawArea_MIN_WIDTH 100
- X
- X/* 6 == 6x10, 29 == number of characters to left of pct scales */
- X/*
- X0000000000111111111122222222223333333333444444444455555555556666666666777777777
- X0123456789012345678901234567890123456789012345678901234567890123456789012345678
- X Instant % 93 54 39 0 uuuuuuuuuuuuuuuuuuuuuuuuuuukkkkkkkkkkkkkkkkkkk
- X 5 Sec Avg % 87 26 61 0 uuuuuuuuuuuuukkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
- X10 Sec Avg % 89 45 44 0 uuuuuuuuuuuuuuuuuuuuuukkkkkkkkkkkkkkkkkkkkkk
- X*/
- X#define DrawArea_MIN_HEIGHT (10 * 10) /* 10 characters of 6x10 */
- X
- X#define DrawArea_DEFAULT_WIDTH (80 * 6)
- X#define DrawArea_DEFAULT_HEIGHT (43 * 10)
- X#define DrawArea_DEFAULT_TLX 5
- X#define DrawArea_DEFAULT_TLY 5
- X
- X#define CPU_AVG_MAX 10
- X#define WAIT_AVG_MAX 10
- X
- Xextern XtAppContext appcon;
- Xextern Widget AppShellW;
- Xextern Widget MainWindowW;
- Xextern Widget DrawAreaW;
- Xextern XWindowAttributes DrawAreaXYWH;
- Xextern Display *display;
- Xextern Window window;
- Xextern GC gc;
- Xextern Colormap cmap;
- Xextern int screen;
- Xextern Window root_window;
- X
- Xextern MyResources res;
- Xextern XColor colorBackground;
- Xextern XColor colorForeground;
- Xextern XColor colorBlack;
- Xextern XColor colorRed;
- Xextern XColor colorOrange;
- Xextern XColor colorYellow;
- Xextern XColor colorGreen;
- Xextern XColor colorBlue;
- Xextern XColor colorSlate;
- Xextern XColor colorCyan;
- Xextern unsigned long foreground;
- Xextern unsigned long background;
- X
- Xextern int current_display_mode;
- Xextern int queued_display_mode;
- Xextern int redrawing_entire_DrawArea;
- X
- Xextern int MyButtons_next_tlx;
- Xextern int DispMsg_tlx;
- X
- X#if defined(WANT_MON_EXTERNS)
- Xextern unsigned long StatCycle_msec;
- X
- X#define sysidelta(x) (sysinfo.x - sysinfo_last.x)
- Xextern struct sysinfo sysinfo;
- Xextern struct sysinfo sysinfo_last;
- X
- X#define midelta(x) (minfo.x - minfo_last.x)
- Xextern struct minfo minfo;
- Xextern struct minfo minfo_last;
- Xextern struct bootinfo bootinfo;
- Xextern swpt_t swaptab [];
- Xextern swpi_t swapin;
- Xextern struct tune tune;
- Xextern struct utsname utsname;
- Xextern struct var v;
- Xextern struct timeb timeb_cycle_start;
- Xextern struct timeb timeb_cycle_end;
- Xextern struct timeb timeb_info_read;
- Xextern struct timeb timeb_last_info_read;
- Xextern int hz;
- Xextern int nswap; /* seems to be in units of NBPSCTR bytes */
- Xextern int maxmem;
- Xextern int freemem;
- Xextern daddr_t myreadlen;
- Xextern int myreadcnt;
- Xextern int cpu_avg_init;
- Xextern time_t *cpu_avg[];
- Xextern time_t cpu_ticks[];
- Xextern int wait_avg_init;
- Xextern time_t *wait_avg[];
- Xextern time_t wait_ticks[];
- X#endif /* defined(WANT_MON_EXTERNS) */
- X
- X/* vi: set tabstop=4 shiftwidth=4: */
- X/* end of x386mon.h */
- SHAR_EOF
- chmod 0644 x386mon/x386mon.h ||
- echo 'restore of x386mon/x386mon.h failed'
- Wc_c="`wc -c < 'x386mon/x386mon.h'`"
- test 6070 -eq "$Wc_c" ||
- echo 'x386mon/x386mon.h: original size 6070, current size' "$Wc_c"
- fi
- # ============= x386mon/xincs.h ==============
- if test -f 'x386mon/xincs.h' -a X"$1" != X"-c"; then
- echo 'x - skipping x386mon/xincs.h (File already exists)'
- else
- echo 'x - extracting x386mon/xincs.h (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'x386mon/xincs.h' &&
- X/*+-------------------------------------------------------------------------
- X xincs.h
- X wht@n4hgf.Mt-Park.GA.US
- X--------------------------------------------------------------------------*/
- X/*+:EDITS:*/
- X/*:01-12-1991-04:35-wht@n4hgf-x1.00 (flush old edit notes) */
- X
- X#include <X11/Xlib.h>
- X#include <X11/Xutil.h>
- X#include <X11/Intrinsic.h>
- X#include <X11/Shell.h>
- X#include <Xm/MainW.h>
- X#include <Xm/BulletinB.h>
- X#include <Xm/PushB.h>
- X
- X/* vi: set tabstop=4 shiftwidth=4: */
- X/* end of xincs.h */
- SHAR_EOF
- chmod 0644 x386mon/xincs.h ||
- echo 'restore of x386mon/xincs.h failed'
- Wc_c="`wc -c < 'x386mon/xincs.h'`"
- test 489 -eq "$Wc_c" ||
- echo 'x386mon/xincs.h: original size 489, current size' "$Wc_c"
- fi
- # ============= x386mon/xprocs.c ==============
- if test -f 'x386mon/xprocs.c' -a X"$1" != X"-c"; then
- echo 'x - skipping x386mon/xprocs.c (File already exists)'
- else
- echo 'x - extracting x386mon/xprocs.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'x386mon/xprocs.c' &&
- X/*+-------------------------------------------------------------------------
- X xprocs.c - X386MON X interface (fonts, colors)
- X wht@n4hgf.Mt-Park.GA.US
- X
- X Defined functions:
- X alloc_color(color_name,rtn)
- X choose_MyFont()
- X init_MyFonts()
- X init_color()
- X use_MyFont(num)
- X
- X--------------------------------------------------------------------------*/
- X/*+:EDITS:*/
- X/*:01-12-1991-04:35-wht@n4hgf-x1.00 (flush old edit notes) */
- X
- X#include "x386mon.h"
- X
- XXColor colorBackground;
- XXColor colorForeground;
- XXColor colorBlack;
- XXColor colorRed;
- XXColor colorOrange;
- XXColor colorYellow;
- XXColor colorGreen;
- XXColor colorBlue;
- XXColor colorSlate;
- XXColor colorCyan;
- X
- Xunsigned long foreground;
- Xunsigned long background;
- X
- XMyFontStruct my_fonts[] =
- X{
- X {"6x10"},
- X {(char *)0}
- X};
- X#define MyFont_QUANTITY 4
- X
- XMyFontStruct *currentMyFont = (MyFontStruct *)0;
- X
- X/*+-------------------------------------------------------------------------
- X use_MyFont(num)
- X--------------------------------------------------------------------------*/
- Xvoid
- Xuse_MyFont(num)
- Xint num;
- X{
- X currentMyFont = &my_fonts[num];
- X XSetFont(display,gc,currentMyFont->fid);
- X
- X} /* end of use_MyFont */
- X
- X/*+-------------------------------------------------------------------------
- X choose_MyFont() - choose font based on current window size
- X--------------------------------------------------------------------------*/
- Xvoid
- Xchoose_MyFont()
- X{
- X} /* end of choose_MyFont */
- X
- X/*+-------------------------------------------------------------------------
- X init_MyFonts()
- X--------------------------------------------------------------------------*/
- Xvoid
- Xinit_MyFonts()
- X{
- Xregister MyFontStruct *thisMyFont = my_fonts;
- X
- X while(thisMyFont->name)
- X {
- X if((thisMyFont->fid = XLoadFont(display,thisMyFont->name)) != BadName)
- X {
- X thisMyFont->font_struct = XQueryFont(display,thisMyFont->fid);
- X thisMyFont->width = thisMyFont->font_struct->max_bounds.width;
- X thisMyFont->height =
- X thisMyFont->font_struct->max_bounds.ascent +
- X thisMyFont->font_struct->max_bounds.descent;
- X thisMyFont->gap = thisMyFont->height / 3;
- X }
- X else
- X thisMyFont->width = 0;
- X thisMyFont++;
- X }
- X
- X use_MyFont(0);
- X
- X} /* end of init_MyFonts */
- X
- X/*+-------------------------------------------------------------------------
- X alloc_color(color_name,rtn)
- X--------------------------------------------------------------------------*/
- Xint
- Xalloc_color(color_name,rtn)
- Xregister char *color_name;
- XXColor *rtn;
- X{
- X XColor exact;
- X XColor color;
- X Status ret;
- X
- X if( ((ret = XAllocNamedColor(display,cmap,color_name,
- X &exact,&color)) == BadColor) || (ret == BadValue))
- X {
- X *rtn = colorBlack;
- X return(-1);
- X }
- X *rtn = exact;
- X return(0);
- X
- X} /* end of alloc_color */
- X
- X/*+-------------------------------------------------------------------------
- X init_color()
- X--------------------------------------------------------------------------*/
- Xvoid
- Xinit_color()
- X{
- X alloc_color("black",&colorBlack); /* first */
- X
- X alloc_color(res.background,&colorBackground);
- X background = colorBackground.pixel;
- X
- X alloc_color(res.foreground,&colorForeground);
- X foreground = colorForeground.pixel;
- X
- X alloc_color("gray",&colorSlate);
- X
- X if(alloc_color("red",&colorRed))
- X colorRed = colorForeground;
- X
- X if(alloc_color("yellow",&colorYellow))
- X colorRed = colorForeground;
- X
- X if(alloc_color("green",&colorGreen))
- X colorGreen = colorForeground;
- X
- X if(alloc_color("blue",&colorBlue))
- X colorBlue = colorForeground;
- X
- X if(alloc_color("cyan",&colorCyan))
- X colorCyan = colorForeground;
- X
- X if(alloc_color("orange",&colorOrange))
- X colorOrange = colorForeground;
- X
- X} /* end of init_color */
- X
- X/* vi: set tabstop=4 shiftwidth=4: */
- X/* end of xprocs.c */
- SHAR_EOF
- chmod 0644 x386mon/xprocs.c ||
- echo 'restore of x386mon/xprocs.c failed'
- Wc_c="`wc -c < 'x386mon/xprocs.c'`"
- test 3597 -eq "$Wc_c" ||
- echo 'x386mon/xprocs.c: original size 3597, current size' "$Wc_c"
- fi
- exit 0
-
- -----------------------------------------------------------------------
- Warren Tucker, TuckerWare gatech!n4hgf!wht or wht@n4hgf.Mt-Park.GA.US
- Many [Nobel physics] prizes have been given to people for telling us
- the universe is not as simple as we thought it was. -Stephen Hawking in
- A Brief History of Time In computing, there are no such prizes. -me
-