Path: utzoo!hoptoad!amdcad!decwrl!labrea!rutgers!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uhnix1!sugar!amiga-sources@sugar.uu.net From: amiga-sources@sugar.uu.net (alt.sources.amiga) Newsgroups: alt.sources.amiga Subject: meter: memory meter -- Howard Hull Message-ID: <2824@sugar.uu.net> Date: 15 Oct 88 13:13:14 GMT Sender: peter@sugar.uu.net Organization: Hackercorp Lines: 1486 Approved: amiga-sources@sugar.uu.net (alt.sources.amiga) Archive: uunet!~uucp/amiga-sources/meter.sh.Z : #! /bin/sh # This is a shell archive, created on Sugar Land Unix (..!uunet!sugar) # (bbs: 713-438-5018) by peter (Peter da Silva) on Sat Oct 15 08:05:28 1988 # Remove anything before the "#! /bin/sh" line, then unpack it by saving # it into a file and typing "sh file". If you do not have sh, you need # unshar, a dearchiving program which is widely available. In the absolute # wost case, you can crack the files out by hand. # If the archive is complete, you will see the message "End of archive." # at the end. # This archive contains the following files... # 'mm.doc' # 'mm.h' # 'mm3.c' # 'mminit3.c' # To extract them, run the following through /bin/sh echo x - mm.doc sed 's/^X//' > mm.doc << '//END_OF_FILE' X/* : ai=0 bk=0 ts=8 */ X/* X * MemMometer - program hacked from Rokicki's WFrags more or less... X * (in fact, a heck of a lot) in the style of Peter DaSilva's "Gauge." X * The program opens a narrow window with the same dimensions as the X * disk capacity gadget found in the top-level workbench window for X * a floppy volume. The sizing gadget is like the one in Gauge; to X * resize the window, just click the left mouse button over the "E". X * My bin copy of Gauge broke when I put a Michigan Insider in my A1000. X * I did not have source for the Gauge program, so I conjured this one. X * X * Note that in the display there's one memmometer for Chip (left-hand X * column ), another for Slow Fast mem (center column) and another for X * Fast mem (right-hand column ). These memmometers can be turned on or X * off as desired by selecting "NONE" or the various items in the Size X * menus. Parts of several FD programs have been used to make MemMometer. X * Menus, for instance, are a la VT100 (Wecker, et al). As with the X * VT100 program, MemMometer has preset variables. However, the program X * does not presently contain a script file reader or an AREXX interface X * with which to automatically set the variables. Maybe this will X * happen in a future rev (volunteers?). X * X * FRAGS mode: X * The 'mometers display a frequently-updated window indicating the extent X * of memory fragmentation and free memory, thus showing the sizes of the X * largest available chunks. Black is unallocated, blue is partially X * framented, red-orange is fully allocated. It takes a while after X * startup to settle out and display the upper fast mem, so be patient... X * It's useful for finding out why those large programs won't load. Also X * useful during development to see what impact your application is having X * on memory fragmentation. X * X * WARPS mode: X * The 'mometer displays any change that it sees in memory, BUT this mode X * only works sensibly when JUST ONE memory size selection is active (set X * others to "NONE"). Black areas are unchanged sections of memory, blue X * areas are sections with zeroed long words in them, and red-orange areas X * are sections containing recently changed long words. Given that you X * may have two areas of memory active in the compare, though, it is X * possible to set it up (by careful planning w.r.t. the ways of AmigaDOS X * memory management) so that something double buffered between CHIP and X * RAM can be compared using this "mis-feature." If you can load an area, X * say, at a selectable boundary in RAM and its counterpart at the 256K X * boundary in CHIP, (or similarly juggled arrangements in slow-fast and X * fast RAM) you can use WARPS to judge the extent of differences between X * two or perhaps even three similar fields. X * X * To run, simply type X * X * run MM3 or click on the icon. X * X * Then open the menu item selections and set them for your configuration. X * Frags mode, 512K of CHIP @0, 0.5Meg of SF @C00000, and 2MB FAST mem are X * the defaults. Timing (Freq) is rather ragged, sorry about that... X * X * That's all! Enjoy this program. Forget about the bugs. :-) mm3 uses X * Amy's Forbid, Permit, and the notorious v1.2 Delay function - so you'll X * probably get a track 40 error some day when you expect it least (I did). X * It's good discipline for remembering to make backups... ::--)) X * X * The source to mm3 is freely distributable; the copy of Rokiki's WFrags X * I was working with had no copyright or distribution restrictions, and X * Wecker's VT100 is known to be in the public domain. I add no further X * restrictions to, nor accept any responsibilities for the use of the X * codes herein, which are recommended for entertainment purposes only. X * So get out your Manx 3.6a compiler and fix the bugs yourself, then X * compile and link as described in the makefile. X * Good Luck. X * X * Howard Hull (The C Barbarian)* hull@hao.ucar.edu X * X * *( A matter of primitive language, not piracy...) X */ //END_OF_FILE echo x - mm.h sed 's/^X//' > mm.h << '//END_OF_FILE' X/* : ai=0 bk=0 ts=8 */ X#include X#include X#include X#include X#include X#include X#include X Xextern struct IntuitionBase *IntuitionBase ; Xextern struct Window *window ; Xextern struct MsgPort *myport ; X //END_OF_FILE echo x - mm3.c sed 's/^X//' > mm3.c << '//END_OF_FILE' X/* : ai=0 bk=0 ts=8 */ X#include "mm.h" X X#define REDP 3L /* workbench pen colors for Draw and RectFill */ X#define BLKP 2L X#define WHTP 1L X#define BLUP 0L X X#define SOK 0x001f /* memory allocation control masks */ X#define S1 0x0001 X#define S2 0x0002 X#define S4 0x0004 X#define S8 0x0008 X#define SA 0x0010 X#define C1 0xfffe X#define C2 0xfffd X#define C4 0xfffb X#define C8 0xfff7 X#define CA 0xffef X X#define EXTENSION 16L /* allocation request increment */ X X#define EVENMASK 0x7ffffffe /* used to prevent odd address traps */ X#define CLIHEIGHT 200L /* window scaling stuff */ X#define SIZEGAD 9L X#define DRAGBAR 10L X#define BORDER 2L X#define WINW 16L /* initial window width */ X#define WINH (long)(CLIHEIGHT - SIZEGAD - DRAGBAR) /* initial win height */ X#define MINH 81L /* shortest allowable window */ X#define MAXH 576L /* longest allowable window */ X#define BART 1L /* title bar F text location */ X#define BARH (long)(WINH - SIZEGAD - DRAGBAR) /* bar height */ X#define BARS (long)(BARH + 1) /* number of memory items to allocate */ X#define BARB (long)(BARH + DRAGBAR - 1) /* bottom of mercury column */ X#define BARE (long)(BARB + BORDER) /* bar end E text position */ X#define BARW (long)(((WINW - (2 * BORDER)) / 3) - 1) /* 3 memfragmometers */ X#define LEFT BORDER /* SLOW : since we're syncopated, we */ X#define MIDDLE (LEFT + BARW + 1) /* SLOW-FAST : do it going from bar */ X#define RIGHT (MIDDLE + BARW + 1) /* FAST :to bar at an irregular pace */ X#define RTEXT - 4L /* offset for three char E/F text from left edge */ X#define STARTVAL 64L /* start by getting enough storage for a few frags */ X X/* typedef short BOOL */ /* this is in include/exec/types.h */ X Xstruct IntuitionBase *IntuitionBase ; Xstruct Window *window ; Xstruct IntuiMessage *message; X/* struct IntuiMessage *GetMsg(); */ /* in functions.h */ X Xstruct GfxBase *GfxBase ; X Xextern void InitProjItems(); /* this stuff is in the mminit section */ Xextern void InitSetupItems(); Xextern void InitChipItems(); Xextern void InitChipAItems(); Xextern void InitSFItems(); Xextern void InitSFAItems(); Xextern void InitFastItems(); Xextern void InitFastAItems(); Xextern void InitMenu(); Xextern void StartMenus(); X XBOOL p_mode = 0; /* preset frags mode = 0, warps mode = 1 */ Xlong p_rate = 2; /* preset sample interval, secs see menu */ Xlong p_chip = 512; /* preset chip mem size, kbytes see menu */ Xlong p_chipa = 0; /* preset chip mem address, kb see menu */ Xlong p_sf = 512; /* preset slowfast mem size, kb see menu */ Xlong p_sfa = 0x3000; /* preset slowfast mem addr, kb see menu */ Xlong p_fast = 2; /* preset fast mem size, mbytes see menu */ Xlong p_fasta = 2; /* preset fast mem addr, mbytes see menu */ X Xstatic BOOL mode; /* uninitialized for mode menu */ Xstatic long delayval; /* uninitialized for delay menu */ Xstatic long cmemsize; /* uninitialized for chip menu */ Xstatic long cmembase; /* uninitialized for chipa menu */ Xstatic long sfmemsize; /* uninitialized for sf menu */ Xstatic long sfmembase; /* uninitialized for sfa menu */ Xstatic long fmemsize; /* uninitialized for fast menu */ Xstatic long fmembase; /* uninitialized for fasta menu */ X Xstatic USHORT log ; Xstatic BOOL things_are_cool = TRUE ; /* tells when to close the window */ Xstatic BOOL intsig = FALSE ; /* intuition message detector */ Xstatic long chip[3], fast[3] ; /* place to keep mem header pointers */ Xstatic ULONG *chunkv ; /* demand allocated for frag chunks */ Xstatic ULONG *sizev ; /* demand allocated for frag sizes */ Xstatic ULONG *csum ; /* a col's height worth of checksums */ Xstatic ULONG *oldcsum ; /* same height worth of old checksums */ Xstatic USHORT *cell; /* 1 cell per pixel height of mercury */ Xstatic long x1, x2 ; /* used to Draw() memometer segments */ Xstatic long frags = STARTVAL ; /* # of demand allocated frag items */ Xstatic long warps = BARS ; /* # of demand allocated column items */ Xstatic long barh = BARH ; /* EVEN #'d height of mercury column */ Xstatic long barb = BARB ; /* bottom position of mercury column */ X X/* struct RastPort *rp ; */ /* wonder why we don't need this... ? */ X Xstatic struct TextAttr myfont = { X (STRPTR) "topaz.font", X TOPAZ_EIGHTY, X 0, X 0 X}; X/* E newsize gadget refresh text */ Xstatic char ebuf[4] = " E " ; Xstatic struct IntuiText e_text = { X BLUP, WHTP, X JAM2, X 0, BARE, X &myfont, X (UBYTE *)ebuf, X NULL X}; X/* F title refresh text */ Xstatic char fbuf[4] = " F " ; Xstatic struct IntuiText f_text = { X BLUP, WHTP, X JAM2, X 0, BART, X &myfont, X (UBYTE *)fbuf, X &e_text X}; Xstatic struct NewWindow newwindow = { X 0, /* left edge */ X 10, /* top edge */ X WINW, /* width */ X WINH, /* height */ X 0, /* detail pen */ X 1, /* block pen */ X MENUPICK | NEWSIZE, /* messages */ X/* WINDOWDEPTH | WINDOWCLOSE */ /* don't use these gads */ X WINDOWDRAG | WINDOWSIZING | SMART_REFRESH, /* add a few gadgets */ X NULL, /* no custom gadgets */ X NULL, /* default checkmark */ X (UBYTE *)"F", /* title */ X NULL, /* initialize this! */ X NULL, /* use screen bitmap */ X WINW, MINH, WINW, MAXH, /* min and max sizes */ X WBENCHSCREEN } ; /* use workbench screen */ X Xvoid initmenus() X{ X (void) InitProjItems(); /* Initialize the menu items */ X (void) InitSetupItems(); X (void) InitChipItems(); X (void) InitChipAItems(); X (void) InitSFItems(); X (void) InitSFAItems(); X (void) InitFastItems(); X (void) InitFastAItems(); X (void) InitMenu(); X (void) StartMenus(); X } X Xvoid handle_MENUPICK( class, code ) Xunsigned long class; Xunsigned int code; X{ X unsigned int menunum, itemnum, subnum; X X if (code == MENUNULL) return; X X menunum = MENUNUM( code ); X itemnum = ITEMNUM( code ); X subnum = SUBNUM( code ); X switch( menunum ) { X case 0: X switch( itemnum ) { X case 0: X WindowToFront(window); X break; X X case 1: X WindowToBack(window); X break; X X case 2: X things_are_cool = FALSE; X break; X } /* end of switch ( Project itemnum ) */ X break; X X case 1: X switch( itemnum ) { X case 0: X switch( subnum ) { X case 0: X mode = FALSE ; X break; X X case 1: X mode = TRUE ; X break; X /* end of switch ( Mode subnum ) */ X } X break; X case 1: X switch( subnum ) { X case 0: X delayval = 36; X break; X X case 1: X delayval = 72; X break; X X case 2: X delayval = 180; X break; X X case 3: X delayval = 360; X break; X /* end of switch ( Freq subnum ) */ X } X break; X /* end of switch ( Setup itemnum ) */ X } X break; X X case 2: X switch( itemnum ) { X case 0: X cmemsize = 0x000000; X break; X X case 1: X cmemsize = 0x040000; X break; X X case 2: X cmemsize = 0x080000; X break; X X case 3: X cmemsize = 0x100000; X break; X X case 4: X cmemsize = 0x200000; X break; X } X /* end of switch ( Chip Size itemnum ) */ X break; X X case 3: X switch( itemnum ) { X case 0: X cmembase = 0x000000; X break; X X case 1: X cmembase = 0x040000; X break; X X case 2: X cmembase = 0x080000; X break; X X case 3: X cmembase = 0x100000; X break; X } X /* end of switch ( Chip Addr itemnum ) */ X break; X X case 4: X switch( itemnum ) { X case 0: X sfmemsize = 0x000000; X break; X X case 1: X sfmemsize = 0x080000; X break; X X case 2: X sfmemsize = 0x100000; X break; X X case 3: X sfmemsize = 0x180000; X break; X } X /* end of switch ( SF Size itemnum ) */ X break; X X case 5: X switch( itemnum ) { X case 0: X sfmembase = 0xc00000; X break; X X case 1: X sfmembase = 0xc80000; X break; X X case 2: X sfmembase = 0xd00000; X break; X X case 3: X sfmembase = 0xd80000; X break; X } X /* end of switch ( SF Addr itemnum ) */ X break; X X case 6: X switch( itemnum ) { X case 0: X fmemsize = 0x000000; X break; X X case 1: X fmemsize = 0x080000; X break; X X case 2: X fmemsize = 0x100000; X break; X X case 3: X fmemsize = 0x200000; X break; X X case 4: X fmemsize = 0x400000; X break; X X case 5: X fmemsize = 0x600000; X break; X X case 6: X fmemsize = 0x800000; X break; X } X /* end of switch ( Fast Size itemnum ) */ X break; X X case 7: X switch( itemnum ) { X case 0: X fmembase = 0x200000; X break; X X case 1: X fmembase = 0x300000; X break; X X case 2: X fmembase = 0x400000; X break; X X case 3: X fmembase = 0x500000; X break; X X case 4: X fmembase = 0x600000; X break; X X case 5: X fmembase = 0x700000; X break; X X case 6: X fmembase = 0x800000; X break; X X case 7: X fmembase = 0x900000; X break; X } X /* end of switch ( Fast Addr itemnum ) */ X break; X } X /* end of switch ( menunum ) */ X} X Xvoid wrack_sploot() /* this subprogram cashes in the chips in bad times */ X { X if (log != 0) { X if (log & SA) { X (void) FreeMem(oldcsum, (long)(sizeof(ULONG) * warps)) ; X log = log & CA ; X } X if (log & S8) { X (void) FreeMem(csum, (long)(sizeof(ULONG) * warps)) ; X log = log & C8 ; X } X if (log & S4) { X (void) FreeMem(sizev, (long)(sizeof(long) * frags)) ; X log = log & C4 ; X } X if (log & S2) { X (void) FreeMem(chunkv, (long)(sizeof(long) * frags)) ; X log = log & C2 ; X } X if (log & S1) { X (void) FreeMem(cell, (long)(sizeof(USHORT) * warps)) ; X log = log & C1 ; X } X frags = 0; X warps = 0; X } X} X Xvoid handle_NEWSIZE() /* oh rats, the user found the size gadget... */ X { X if (barh != window->Height) { /* cash in the old memory allocations */ X if (log & SA) { X (void) FreeMem(oldcsum, (long)(sizeof(ULONG) * warps)) ; X log = log & CA ; X } X if (log & S8) { X (void) FreeMem(csum, (long)(sizeof(ULONG) * warps)) ; X log = log & C8 ; X } X if (log & S1) { X (void) FreeMem(cell, (long)(sizeof(USHORT) * warps)) ; X log = log & C1 ; X } X barh = window->Height - SIZEGAD - DRAGBAR ; /* recalculate height */ X barb = window->Height - SIZEGAD - 1 ; /* get new bar base position */ X warps = barh + 1 ; /* number of storage cells to be reserved */ X if ((cell = (USHORT *)AllocMem((long)sizeof(USHORT) * warps, X MEMF_PUBLIC)) != 0L ) log = log | S1; X if ((csum = (ULONG *)AllocMem((long)sizeof(ULONG) * warps, X MEMF_PUBLIC)) != 0L ) log = log | S8; X if ((oldcsum = (ULONG *)AllocMem((long)sizeof(ULONG) * warps, X MEMF_PUBLIC)) != 0L ) log = log | SA; X if (log != SOK) { /* bail out if we didn't get an allocation */ X wrack_sploot() ; X things_are_cool = FALSE ; /* tell _main that we're leaving */ X } X e_text.TopEdge = barb + BORDER ; /* set the E text position */ X } X} X Xvoid handle_MESSAGES() { X unsigned long class; X unsigned int code, qual; X X /* Wait (1L << window->UserPort->mp_SigBit); this is rediculous! */ X while ((message=(struct IntuiMessage *)GetMsg(window->UserPort)) X != 0L) { X class = message->Class ; X code = message->Code ; X qual = message->Qualifier ; X ReplyMsg ; X switch( class ) { X case NEWSIZE: X intsig = TRUE ; /* resize when done here */ X break ; X X case MENUPICK: X handle_MENUPICK( class, code ) ; /* do menus ASAP */ X break ; X } X } X} X Xvoid memometer() /* this subprogram draws the bar graphs */ X { X long i; X long y; X X i = 0 ; X while ((i < barh) && (intsig == FALSE)) { X y = barb - i ; X SetAPen(window->RPort, (long)cell[i]); X Move(window->RPort, x1, y); X Draw(window->RPort, x2, y); X (void) handle_MESSAGES() ; /* go see if the user wants anything */ X i++ ; X } X} X Xvoid shake() /* this subprogram slings down the mercury column */ X { X int i; X X for (i = 0; i < barh; i++) { X cell[i] = REDP ; X } X} X Xvoid lockout() /* this subprogram renders a whole column in border colors */ X { X (void) handle_MESSAGES() ; /* go see if the user wants anything */ X SetAPen(window->RPort, WHTP) ; /* set in the border color */ X RectFill(window->RPort, x1, (barb - barh + 1), x2, barb) ; /* fill in */ X} X Xvoid updatewarps( wf, membase, memseg ) /* this subprogram finds changes */ Xshort wf; Xlong membase, memseg ; X { X register long i ; X register ULONG r ; X register ULONG delta ; X register ULONG *a ; X X if (memseg == 0) { X (void) lockout() ; X return ; X } X else (void) shake() ; X X delta = (ULONG)(memseg & EVENMASK) ; /* try to avoid odd address trap */ X r = (ULONG)(membase & EVENMASK) ; /* prefer wrong address to death */ X for (i = 0; i < barh; i++) { X csum[i] = 0 ; X } X for (i = 0; i < barh; i++) { X for (a = (ULONG *)r; a < (ULONG *)(r + delta); a++) { X csum[i] += *a ; X } X if (csum[i] == 0) cell[i] = cell[i] & BLUP ; X if (csum[i] == oldcsum[i]) cell[i] = cell[i] & BLKP ; X oldcsum[i] = csum[i] ; X r += delta ; X } X (void) memometer(); X} X Xvoid updatescreen( wf, membase, memseg ) Xshort wf; Xlong membase, memseg; X { X register long size ; X register struct MemHeader *hdr ; X register struct MemChunk *chunk ; X extern struct ExecBase *SysBase ; X register long *which ; /* active memlist chunk pointer */ X register long newlimit ; /* number of chunks, incl 1 null chunk, + 1 */ X register long newfrags ; /* number of chunks, incl null chunks, + 1 */ X long newsize ; /* size of next request for chunkv/sizev memory, + 1 */ X int i, j, k, l ; X int length ; /* length is number of chunks to be processed, + 1 */ X BOOL cf, nf ; /* cf is "chip flag" nf is "null chunk found" flag */ X X if (memseg == 0) { X (void) lockout() ; X return; X } X else (void) shake() ; X X for (i = 0; i < 3; i++) { X chip[i] = 0; X fast[i] = 0; X } X for (i = 0; i < frags; i++) { X chunkv[i] = 0; X sizev[i] = 0; X } X newfrags = 0 ; X newlimit = 0 ; X nf = FALSE; X Forbid() ; X hdr = (struct MemHeader *) SysBase->MemList.lh_Head ; X while (hdr->mh_Node.ln_Succ) { X if (hdr->mh_Attributes & MEMF_CHIP) { X which = chip ; X cf = TRUE; X } X else { X which = fast ; X cf = FALSE; X } X if (((cf == TRUE) && (wf == 0)) || ((cf == FALSE) && (wf > 0))) { X for (chunk = hdr->mh_First; chunk; chunk = chunk->mc_Next) { X if (which[1] < frags) chunkv[which[1]++] = (unsigned long)chunk ; X size = chunk->mc_Bytes ; X if (which[2] < frags) sizev[which[2]++] = (unsigned long)size; X *which += size ; X if (nf == FALSE) { X newlimit++ ; X if (chunkv[newfrags] == NULL) { X nf = TRUE; X } X } X newfrags++ ; X } X } X hdr = (struct MemHeader *)hdr->mh_Node.ln_Succ ; X } X Permit() ; X length = frags ; X if (newlimit < frags) length = newlimit ; X for (i = 0; i < length; i++) { X chunkv[i] -= membase; /* chunkv is now array offset from base */ X sizev[i] += chunkv[i]; /* and sizev is now address of array top */ X chunkv[i] = chunkv[i] / memseg; /* this is the number of pixels */ X sizev[i] = sizev[i] / memseg; /* and this is the top pixel */ X if (chunkv[i] < 0) chunkv[i] = 0 ; /* we do some bounds checking */ X if (sizev[i] < 0) sizev[i] = 0 ; X if (chunkv[i] >= barh) chunkv[i] = barh - 1 ; X if (sizev[i] >= barh) sizev[i] = barh - 1 ; X if (sizev[i] - chunkv[i] < 0) sizev[i] = chunkv[i] ; X j = chunkv[i] ; /* from now on it will be less confusing if */ X k = sizev[i] ; /* we assign some variables for this stuff */ X if (sizev[i] - chunkv[i] == 0) { X cell[j] = cell[j] & BLUP ; X } X else { X for (l = j; l < k; l++) { X cell[l] = cell[l] & BLKP ; X } X } X } X (void) memometer(); X newsize = frags ; X while (newsize < newlimit) { X newsize += EXTENSION ; X } X if (newlimit > frags) { X (void) FreeMem(chunkv, (long)(sizeof(long) * frags)); X if ((chunkv = (unsigned long *)AllocMem((long)sizeof(long) * newsize, X MEMF_PUBLIC)) == 0L ) { X log = log & C2 ; X } X (void) FreeMem(sizev, (long)(sizeof(long) * frags)); X if ((sizev = (unsigned long *)AllocMem((long)sizeof(long) * newsize, X MEMF_PUBLIC)) == 0L ) { X (void) FreeMem(chunkv, (long)(sizeof(long) * newsize)); X log = log & C4 ; X } X if (log != SOK) { X wrack_sploot() ; X things_are_cool = FALSE ; X } X else frags = newsize ; X } X} X Xmain() { X int i; X short wf; X long cmemseg; X long sfmemseg; X long fmemseg; X long membase; X long memseg; X long memsize; X X X log = 0 ; X if ((cell = (USHORT *)AllocMem((long)sizeof(USHORT) * BARS, X MEMF_PUBLIC)) != 0L ) log = log | S1; X if ((chunkv = (ULONG *)AllocMem((long)sizeof(ULONG) * STARTVAL, X MEMF_PUBLIC)) != 0L ) log = log | S2; X if ((sizev = (ULONG *)AllocMem((long)sizeof(ULONG) * STARTVAL, X MEMF_PUBLIC)) != 0L ) log = log | S4; X if ((csum = (ULONG *)AllocMem((long)sizeof(ULONG) * BARS, X MEMF_PUBLIC)) != 0L ) log = log | S8; X if ((oldcsum = (ULONG *)AllocMem((long)sizeof(ULONG) * BARS, X MEMF_PUBLIC)) != 0L ) log = log | SA; X if (log != SOK) { X wrack_sploot() ; X Exit() ; X } X if ((IntuitionBase = (struct IntuitionBase *)OpenLibrary( X "intuition.library",33L)) != NULL && X (window=OpenWindow(&newwindow)) != NULL) { X if ((GfxBase = (struct GfxBase *)OpenLibrary( X "graphics.library", 0L)) != NULL) { X (void) initmenus(); X /* rp = window->RPort ; */ X wf = 0; X mode = p_mode ; X delayval = p_rate * 36 ; X cmemsize = p_chip << 10 ; X cmembase = p_chipa << 10 ; X sfmemsize = p_sf << 10 ; X sfmembase = p_sfa << 10 ; X if (p_fast >= 512) fmemsize = p_fast << 10 ; X else fmemsize = p_fast << 20 ; X fmembase = p_fasta << 20 ; X while (things_are_cool == TRUE) { X cmemseg = cmemsize / barh ; X sfmemseg = sfmemsize / barh ; X fmemseg = fmemsize / barh ; X switch ( wf ) { X case 0: X x1 = LEFT ; X membase = cmembase ; X memseg = cmemseg ; X memsize = cmemsize ; X break; X X case 1: X x1 = MIDDLE ; X membase = sfmembase ; X memseg = sfmemseg ; X memsize = sfmemsize ; X break; X X case 2: X x1 = RIGHT ; X membase = fmembase ; X memseg = fmemseg ; X memsize = fmemsize ; X break; X } X x2 = x1 + BARW ; X if (mode == TRUE) { X (void) updatewarps( wf, membase, memseg ) ; X } X if (mode == FALSE) { X (void) updatescreen( wf, membase, memseg ) ; X } X if (intsig == TRUE) { X handle_NEWSIZE() ; X intsig = FALSE ; X } X if (wf == 2) { X PrintIText(window->RPort,&f_text,RTEXT,0L) ; X Delay(delayval) ; X } X wf++ ; X if (wf >= 3) wf = 0 ; X } /* end of while ( things_are_cool) */ X wrack_sploot() ; X } X if (GfxBase) CloseLibrary(GfxBase) ; X } X if (window) CloseWindow(window) ; X if (IntuitionBase) CloseLibrary(IntuitionBase) ; X} X_cli_parse() {} X_wb_parse() {} //END_OF_FILE echo x - mminit3.c sed 's/^X//' > mminit3.c << '//END_OF_FILE' X/* : ai=0 bk=0 ts=8 */ X#include "mm.h" X X#define PROJMAX 3 /* number of project menu items */ X#define SETUPMAX 2 /* number of setup menu items */ X#define MODEMAX 2 X#define FREQMAX 4 /* number of frequency menu items */ X#define CHIPMAX 5 /* number of chip mem size menu items */ X#define CHIPAMAX 4 /* number of chip mem base addr menu items */ X#define SFMAX 4 /* number of sf mem size menu items */ X#define SFAMAX 4 /* number of sf mem base addr menu items */ X#define FASTMAX 7 /* number of fast mem size menu items */ X#define FASTAMAX 8 /* number of fast mem base addr menu items */ X#define MAXMENU 9 /* total number of top level menus */ X Xextern BOOL p_mode; /* preset frags mode = 0, warps mode = 1 */ Xextern long p_rate; /* preset sample interval, secs see menu */ Xextern long p_chip; /* preset chip mem size, kbytes see menu */ Xextern long p_chipa; /* preset chip mem address, kb see menu */ Xextern long p_sf; /* preset slowfast mem size, kb see menu */ Xextern long p_sfa; /* preset slowfast mem addr, kb see menu */ Xextern long p_fast; /* preset fast mem size, mbytes see menu */ Xextern long p_fasta; /* preset fast mem addr, mbytes see menu */ X X/******************************************************/ X/* Structure declarations for the menu sections */ X/******************************************************/ X Xstruct MenuItem ProjItem[PROJMAX]; Xstruct IntuiText ProjText[PROJMAX]; Xstruct MenuItem SetupItem[SETUPMAX]; Xstruct IntuiText SetupText[SETUPMAX]; Xstruct MenuItem ModeItem[MODEMAX]; Xstruct IntuiText ModeText[MODEMAX]; Xstruct MenuItem FreqItem[FREQMAX]; Xstruct IntuiText FreqText[FREQMAX]; Xstruct MenuItem ChipItem[CHIPMAX]; Xstruct IntuiText ChipText[CHIPMAX]; Xstruct MenuItem ChipAItem[CHIPAMAX]; Xstruct IntuiText ChipAText[CHIPAMAX]; Xstruct MenuItem SFItem[SFMAX]; Xstruct IntuiText SFText[SFMAX]; Xstruct MenuItem SFAItem[SFAMAX]; Xstruct IntuiText SFAText[SFAMAX]; Xstruct MenuItem FastItem[FASTMAX]; Xstruct IntuiText FastText[FASTMAX]; Xstruct MenuItem FastAItem[FASTAMAX]; Xstruct IntuiText FastAText[FASTAMAX]; Xstruct Menu menu[MAXMENU]; X X/*****************************************************************/ X/* The following function initializes the structure arrays */ X/* needed to provide the Project menu topic. */ X/* this was left retro-compatible with Manx 3.4a (nplus1) */ X/*****************************************************************/ Xvoid InitProjItems() X { X int n,nplus1; X X/* initialize each menu item and IntuiText with loop */ Xfor( n=0; n