Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!news.larc.nasa.gov!amiga-request From: amiga-request@ab20.larc.nasa.gov (Amiga Sources/Binaries Moderator) Newsgroups: comp.sources.amiga Subject: v91i119: AvailMem 1.12 - continually display free fast and chip memory, Part01/01 Message-ID: Date: 14 Jun 91 22:13:23 GMT Reply-To: davids@ucscf.UCSC.EDU (Dave Schreiber) Lines: 529 Approved: tadguy@uunet.UU.NET (Tad Guy) X-Mail-Submissions-To: amiga@uunet.uu.net X-Post-Discussions-To: comp.sys.amiga.misc Submitted-by: davids@ucscf.UCSC.EDU (Dave Schreiber) Posting-number: Volume 91, Issue 119 Archive-name: utilities/availmem-1.12/part01 [ includes uuencoded executable and icons ...tad ] AvailMem V1.12 is a small utility designed to provide a constant display of both the total amount and largest block of free chip, fast, and total memory. What makes AvailMem different from other free-memory tools is that the memory sizes are in bytes, not K (perhaps I've been using Workbench too long, but that's just the way I prefer it). This is an upgrade to version 1.10; support for non-topaz default fonts and title bar fonts has been added (for use under Kickstart 2.0). -Dave Schreiber davids@ucscb.ucsc.edu #!/bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh '.info.uu' <<'END_OF_FILE' Xbegin 666 .info X@\TP`$@``$P0```,+```+&$%V86EL365M"E)%041-10H`G X`` Xend Xsize 32 END_OF_FILE if test 78 -ne `wc -c <'.info.uu'`; then echo shar: \"'.info.uu'\" unpacked with wrong size! fi # end of '.info.uu' fi if test -f 'AvailMem.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'AvailMem.h'\" else echo shar: Extracting \"'AvailMem.h'\" \(1205 characters\) sed "s/^X//" >'AvailMem.h' <<'END_OF_FILE' X Xstruct IntuiText IText12 = { X 1,0,JAM2, X 154,53, X NULL, X " ", X NULL X}; X Xstruct IntuiText IText11 = { X 1,0,JAM2, X 154,43, X NULL, X " ", X &IText12 X}; X Xstruct IntuiText IText10 = { X 1,0,JAM2, X 154,33, X NULL, X " ", X &IText11 X}; X Xstruct IntuiText IText9 = { X 1,0,JAM2, X 73,53, X NULL, X " ", X &IText10 X}; X Xstruct IntuiText IText8 = { X 1,0,JAM2, X 73,43, X NULL, X " ", X &IText9 X}; X Xstruct IntuiText IText7 = { X 1,0,JAM2, X 73,33, X NULL, X " ", X &IText8 X}; X Xstruct IntuiText IText6 = { X 1,0,JAM2, X 154,23, X NULL, X "Largest:", X &IText7 X}; X Xstruct IntuiText IText5 = { X 1,0,JAM2, X 73,23, X NULL, X "Total:", X &IText6 X}; X Xstruct IntuiText IText4 = { X 1,0,JAM2, X 15,12, X NULL, X "Available memory (in bytes):", X &IText5 X}; X Xstruct IntuiText IText3 = { X 1,0,JAM2, X 14,53, X NULL, X "Total:", X &IText4 X}; X Xstruct IntuiText IText2 = { X 1,0,JAM2, X 15,43, X NULL, X "Chip:", X &IText3 X}; X Xstruct IntuiText IText1 = { X 1,0,JAM2, X 15,33, X NULL, X "Fast:", X &IText2 X}; X X#define IntuiTextList1 IText1 X Xstruct NewWindow NewWindowStructure1 = { X 356,26, X 243,68, X 0,1, X CLOSEWINDOW, X WINDOWDRAG+WINDOWDEPTH+WINDOWCLOSE, X NULL, X NULL, X "AvailMem V1.12", X NULL, X NULL, X 5,5, X 640,200, X WBENCHSCREEN X}; END_OF_FILE if test 1205 -ne `wc -c <'AvailMem.h'`; then echo shar: \"'AvailMem.h'\" unpacked with wrong size! fi # end of 'AvailMem.h' fi if test -f 'AvailMem.uu' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'AvailMem.uu'\" else echo shar: Extracting \"'AvailMem.uu'\" \(4839 characters\) sed "s/^X//" >'AvailMem.uu' <<'END_OF_FILE' Xbegin 666 AvailMem XM```#\P`````````"``````````$```)G````_````^D```)G2.=^_B1()`!)W XM^0`````L>``$1_D```)`<@`@/````&Q@`B;!4L`7$ZN_HPI[ XM0`)\+P`D0"`J`"1G$BQL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`D0&00`P$L%*@&;P(`D0X;_)9OI"$)"/3EU.1 XM=0``2.<`,B9L`]P@"V<4)%,B2R`I``@L>``$3J[_+B9*8.B1R"E(`^`I2`/0```G@B;P`(3J[^8BQ?3G4O" XM#BQY```">"!O``A.KOZ,+%].=2\.+'D```)X(F\`""`O``Q.KOW8+%].=2\.$ XM+'D```*4(&\`"$ZN_[@L7TYU+PXL>0```I0@;P`(3J[_-"Q?3G4O#BQY```"# XME$SO`P``"$SO``,`$$ZN_R@L7TYU```#[`````H````!```)A```"7````E<^ XM```)1```"3````D<```)"```"/0````4````"@````````/P`````U]00``"4`````"7T=E=$US9P````DL````V XM!%]#;&]S94QI8G)A````"B`@D XM("`@("`@```!``$``)H`(0`````````\````*"`@("`@("`@```!``$``$D`L XM-0````````!:````1B`@("`@("`@```!``$``$D`*P````````!X````9"`@G XM("`@("`@```!``$``$D`(0````````"6````@DQA71E'AvailMem0.uu' <<'END_OF_FILE' Xbegin 666 AvailMem.info XMXQ```0``````+P`=`#4`%0`&``$``0?"<$`'PM XM``#``````````,``````````P`````````#``````````,``````````P```` XM``````"```````````````````@`%55555556``555555558`!55555555@`* XM%55555556``5``````58`!0``````5@`%``````!6``4``````%8`!0`````C XM`5@`%0`````%6``5=W=W=W58`!5W=W=W=5@`%7=W=W=U6``5(B(B(B58`!4B6 XF(B(B)5@`%0`````%6``555555558`!55555555@`?_______^``B5 X`` Xend Xsize 758 END_OF_FILE if test 1103 -ne `wc -c <'AvailMem0.uu'`; then echo shar: \"'AvailMem0.uu'\" unpacked with wrong size! fi # end of 'AvailMem0.uu' fi if test -f 'Availmem.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Availmem.c'\" else echo shar: Extracting \"'Availmem.c'\" \(4399 characters\) sed "s/^X//" >'Availmem.c' <<'END_OF_FILE' X/*------------------------- AvailMem V1.12 ----------------------------*/ X/*Written and copyright (c)1988-1991 by Dave Schreiber. All rights */ X/*reserved. This program may not be sold, but reasonable charges for */ X/*media, duplication, shipping/handling, etc. are permitted. */ X/*---------------------------------------------------------------------*/ X/*Keeps a running count of the amount of FAST, CHIP, and total memory */ X/*free. Updates every .7 seconds. Compiled with SAS/C V5.10. */ X/*To compile: */ X/* 1> lc -v -Lcd AvailMem */ X/*----------------------------- Enjoy ---------------------------------*/ X/*Version history: */ X/* 1.12 - Fixed a problem with non-8pt default fonts under 2.0 */ X/* 1.10 - Added a counter of the largest block free for FAST, CHIP, and*/ X/* total memory */ X/* 1.03 - First release to the public. Included on Fred Fish disk #285*/ X/*---------------------------------------------------------------------*/ X X X/*Standard #include files*/ X#include X#include X#include X#include X#include X X/*Window and IntuiText definitions*/ X#include "AvailMem.h" X Xstruct IntuitionBase *IntuitionBase; /*Library base pointers*/ Xstruct GfxBase *GfxBase; X Xvoid MainLoop(); Xvoid MakeString(); Xvoid InitIntuiText(UWORD add,UWORD addX); X X#define Rp Wdw->RPort X X /*Using _main() keeps AmigaDOS from opening an extra */ X_main() /*console window when AvailMem is run from Workbench.*/ X{ X if((IntuitionBase=(struct IntuitionBase *) /*Open Intuition*/ X OpenLibrary("intuition.library",0))==NULL) X exit(10); X /*Open Graphics*/ X if((GfxBase=(struct GfxBase *)OpenLibrary("graphics.library",0))==NULL) X { X CloseLibrary(IntuitionBase); /*Like it really matters...*/ X exit(20); X } X X MainLoop(); X X CloseLibrary(GfxBase); /*Close the libraries*/ X CloseLibrary(IntuitionBase); X return(0); X} X Xvoid MainLoop() /*The main loop*/ X{ X struct Window *Wdw; /*Window pointer*/ X struct Screen *WBScreen; X ULONG c,f; X UWORD add1,add2,addX; X X WBScreen=IntuitionBase->ActiveScreen; X X /*Get font size information*/ X add1 = WBScreen->Font->ta_YSize-8; X add2 = GfxBase->DefaultFont->tf_YSize-8; X addX = GfxBase->DefaultFont->tf_XSize-8; X X /*Change window dimensions to fit default fonts*/ X NewWindowStructure1.Height+=add1+5*add2; X NewWindowStructure1.Width=30*(8+addX); X X InitIntuiText(add2,addX); /*Initialize the IntuiText structures*/ X X /*Open the window*/ X if((Wdw=(struct Window *)OpenWindow(&NewWindowStructure1))==NULL) X exit(30); X X Delay(10); X X PrintIText(Rp,&IText1,-6,2+add1); X X /*while the close gadget wasn't pressed...*/ X while( ( GetMsg(Wdw->UserPort) ) == NULL) X { /*For each possibility, get the memory count, convert it to text, X /*put it into the appropriate intuitext structure,*/ X X c=AvailMem(MEMF_LARGEST|MEMF_CHIP); X f=AvailMem(MEMF_LARGEST|MEMF_FAST); X MakeString(IText12.IText,(c < f) ? f : c); X MakeString(IText11.IText,c); X MakeString(IText10.IText,f); X X c=AvailMem(MEMF_CHIP); X f=AvailMem(MEMF_FAST); X MakeString(IText9.IText,f); X MakeString(IText8.IText,c); X MakeString(IText7.IText,f+c); X X PrintIText(Rp,&IText7,-6,2+add1); /*and print it*/ X Delay(35); /*Wait for .7 seconds, then do the whole thing again*/ X } X CloseWindow(Wdw); /*Close the window*/ X} X Xvoid MakeString(string,amt) /*Convert amt to a string, put into 'string'*/ Xchar *string; /*and pad out with spaces*/ XULONG amt; X{ X BYTE c; X stcu_d(string,amt,8); /*Convert number into text*/ X for(c=strlen(string);c<8;c++) X string[c]=' '; /*Pad out with spaces*/ X X string[8]=NULL; /*And terminate with a NULL*/ X} X X X/*Initializes the IntuiText structures (spaces them according to the */ X/*default fonts).*/ Xvoid InitIntuiText(UWORD add,UWORD addX) X{ X IText5.TopEdge=(IText6.TopEdge+=add); X IText1.TopEdge=IText9.TopEdge=(IText10.TopEdge+=(add*2)); X IText2.TopEdge=IText8.TopEdge=(IText11.TopEdge+=(add*3)); X IText3.TopEdge=IText7.TopEdge=(IText12.TopEdge+=(add*4)); X X IText5.LeftEdge=IText9.LeftEdge=IText8.LeftEdge= X (IText7.LeftEdge+=addX*7); X IText6.LeftEdge=IText10.LeftEdge=IText11.LeftEdge= X (IText12.LeftEdge+=addX*17); X} X END_OF_FILE if test 4399 -ne `wc -c <'Availmem.c'`; then echo shar: \"'Availmem.c'\" unpacked with wrong size! fi # end of 'Availmem.c' fi if test -f 'README' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'README'\" else echo shar: Extracting \"'README'\" \(866 characters\) sed "s/^X//" >'README' <<'END_OF_FILE' X X AvailMem X Version 1.12 X XAvailMem is (c)1988-1991 by Dave Schreiber. All rights reserved. X X AvailMem is a free memory counter that displays the amount of free Xmemory, and the largest free memory block, in bytes (as opposed to Xkilobytes, which is usual for freely-distributable memory counters). To Xrun, either double-click on it's icon (from Workbench) or type 'run XAvailMem' from the CLI. X XTo get in touch with the author, write: X Dave Schreiber X 1234 Collins Lane X San Jose, CA 95129-4208 X davids@ucscb.ucsc.edu (Internet e-mail) X XRevision history: X Version 1.12 - Corrects some bugs that occur under AmigaOS 2.0 when the X default font and title bar font aren't 8 pixels by 8 X pixels X Version 1.10 - Adds counters for the largest block of free fast, chip, X and total memory. X Version 1.03 - First release to public. Appears on Fish disk #285 X END_OF_FILE if test 866 -ne `wc -c <'README'`; then echo shar: \"'README'\" unpacked with wrong size! fi # end of 'README' fi if test -f 'README.info.uu' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'README.info.uu'\" else echo shar: Extracting \"'README.info.uu'\" \(888 characters\) sed "s/^X//" >'README.info.uu' <<'END_OF_FILE' Xbegin 666 README.info XMXQ```0``````-@!&`"@`*0`%``,``0?"V4``````````````````````````L XM```!!/X'PPXP!\`D:````#(````T`````````````!`````````H`"@``@`)O XM*H`#``````#_____@`#`````P`#`````H`#`````D`#`````B`#``_\`A`#`G XM````@@#`/__P_P#``````P#'^_\_PP#``````P#&_W__@P#``````P#'__^_% XMPP#``````P#'[^[_`P#``````P#'^__OPP#``````P#'_?V_PP#``````P#'R XMW_?_@P#``````P#']^WWPP#``````P#'>^^_@P#``````P#'W[_?PP#`````` XM`P#'?>_?`P#``````P#'WW]_PP#``````P#'_][_PP#``````P#'[]?O@P#`M XM`````P#``````P#``````P#______P`````````_____```_____0``_____X XM8``_____<``__`#_>``_____?``_P``/```______``X!`#`/``______``YE XM`(``?``______``X``!`/``______``X$!$`_``______``X!``0/``_____Q XM_``X`@)`/``______``X(`@`?``______``X"!((/``______``XA!!`?``_5 XM_____``X($`@/``______``X@A`@_``______``X(("`/``______``X`"$`H XM/``______``X$"@0?``______``______``______``````````````3. Mail comments to the moderator at . Post requests for sources, and general discussion to comp.sys.amiga.misc.