wecker@cookie.dec.com (DAVE CUM GRANO SALIS WECKER) (12/14/86)
I thought people might like this... it is a repost of Mike Meyer's clock program with the following goodies: 1) It now works under Manx 2) It updates the display every 4 seconds UNLESS memory usage is changing, then it updates every 1/4 second. This means that even though it runs at high priority (20), it stays out of the way unless there are interesting things to monitor (in the way of memory usage). 3) I wrote my own "tiny" printf replacement [fmt()] so this program is SMALL. 4) The display is centered and short enough that it can be used with VT100 and not intefere with the top line of text. 5) I like it ;-) Two side notes: 1. The memory usage numbers are in "k" (i.e., 1024 bytes) so the shell MEM command and this won't appear to agree until you divide the shell number by 1024 (not 1000). 2. This is the program I used to notice the bizarre copy behavior to RAM: (double space usage). I am happy to note that it is COMPLETELY fixed under 1.2 (yea 1.2 ! ! ! !). ==============================CLOCK.C======================================== /* clock - a dumb, digital clock in its own window * * original: Mike Meyer - public domain, not for sale * v1.1: Dave Wecker - under Manx, auto change of timings, no printf * */ #include <exec/types.h> #include <exec/memory.h> #include <exec/tasks.h> #include <devices/timer.h> #include <libraries/dos.h> #include <intuition/intuition.h> #include <stdio.h> /********* the following block can be commented out for LATTICE *******/ #include <functions.h> #ifdef NULL #undef NULL #endif #define NULL ((void *)0) #define INTUITION_REV 1L static struct NewWindow New_Window = { 150, 0, /* Centered, top */ 337, 8, /* Just big enough for the time */ -1, -1, /* Default pens */ CLOSEWINDOW, /* All we care about is closing */ WINDOWCLOSE /* Borderless, fairly standard window */ | WINDOWDEPTH | WINDOWDRAG | SIMPLE_REFRESH | BORDERLESS, (struct Gadget *) NULL, (struct Image *) NULL, (UBYTE *)"", /* Empty title */ (struct Screen *) NULL, (struct BitMap *) NULL, 0, 0, 0, 0, /* no change sizes, doesn't matter */ WBENCHSCREEN /* Of course! */ } ; static char Date_Buffer[] = "Chip:XXX Fast:XXXX Time:XX:XX:XX"; static struct IntuiText Date_Text = { 3, 0, /* Use non standard pen colors */ JAM2, /* Use both of them */ 0, 0, /* in the upper left-hand corner */ (struct TextAttr *) NULL, /* Use default text */ (UBYTE *)Date_Buffer, /* Buffer for time */ (struct IntuiText *) NULL /* All of text */ } ; struct IntuitionBase *IntuitionBase ; /* * Some things that need to be shared with done. */ static struct Window *Wind = NULL ; static struct timerequest Time_Req ; static struct MsgPort *Timer_Port = NULL, *CreatePort() ; /* My own little format routine (so we don't need printf) */ /* str = address in string to place integer */ /* wid = number of digits to fill in */ /* lead= 0 : don't use leading zeros, 1 : use leading */ /* num = number to format */ void fmt(str,wid,lead,num) char *str; int wid,lead,num; { register int i,some; register char chr; some = 0; for (str += --wid; wid >= 0; wid--) { if (num == 0 && some == 1) { if (lead) chr = '0'; else chr = ' '; } else { chr = '0' + (char)(num % 10); num /= 10; some = 1; } *str-- = chr; } } main() { register short hours, minutes, seconds, boring; register short chip_free, fast_free ; register short prev_chip, prev_fast; struct DateStamp now ; struct IntuiMessage *Msg; struct Task *FindTask() ; boring = 0; prev_chip = 0; prev_fast = 0; if ((IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library", INTUITION_REV)) == NULL) done(21); if ((Timer_Port = CreatePort("Timer Port", 0L)) == NULL) done(22); if (OpenDevice(TIMERNAME, UNIT_VBLANK, (char *) &Time_Req, 0L) != 0) done(23); Time_Req.tr_node.io_Message.mn_ReplyPort = Timer_Port ; Time_Req.tr_node.io_Command = TR_ADDREQUEST ; Time_Req.tr_node.io_Flags = 0 ; Time_Req.tr_node.io_Error = 0 ; if ((Wind = (struct Window *) OpenWindow(&New_Window)) == NULL) done(24); /* Nudge me up to high priority */ (void) SetTaskPri((long)FindTask(NULL),20L) ; for (;;) { DateStamp(&now) ; prev_chip = chip_free; chip_free = AvailMem((long)MEMF_CHIP) >> 10; prev_fast = fast_free; fast_free = AvailMem((long)MEMF_FAST) >> 10; hours = now.ds_Minute / 60 ; minutes = now.ds_Minute % 60 ; seconds = now.ds_Tick / TICKS_PER_SECOND; fmt(&Date_Buffer[5], 3,0,chip_free); fmt(&Date_Buffer[14],4,0,fast_free); fmt(&Date_Buffer[24],2,0,hours); fmt(&Date_Buffer[27],2,1,minutes); fmt(&Date_Buffer[30],2,1,seconds); PrintIText(Wind->RPort, &Date_Text, 28L, 0L) ; if (prev_chip == chip_free && prev_fast == fast_free) boring++; else boring = 0; /* if things are happening, wake up every 1/4 second */ if (boring < 16) { Time_Req.tr_time.tv_secs = 0; Time_Req.tr_time.tv_micro = 250000L; } /* if nothing happening, wake up every 4 seconds */ else { boring = 16; Time_Req.tr_time.tv_secs = 4L; Time_Req.tr_time.tv_micro = 0; } SendIO((char *) &Time_Req.tr_node) ; Wait( 1L << Wind->UserPort->mp_SigBit | 1L << Timer_Port->mp_SigBit) ; while (Msg = (struct IntuiMessage *)GetMsg(Wind->UserPort)) { if (Msg->Class == CLOSEWINDOW) { ReplyMsg(Msg) ; done(0) ; } else PrintIText(Wind->RPort, &Date_Text, 28L, 0L); ReplyMsg(Msg) ; } (void) GetMsg(Timer_Port) ; } /* NOTREACHED */ } /* * done - just clean up that which is open, and then leave. */ done(how) int how; { AbortIO((char *) &Time_Req.tr_node) ; if (Wind) CloseWindow(Wind) ; if (Time_Req.tr_node.io_Message.mn_ReplyPort) CloseDevice(&Time_Req) ; if (Timer_Port) DeletePort(Timer_Port) ; if (IntuitionBase) CloseLibrary(IntuitionBase) ; OpenWorkBench() ; /* As requested */ exit(how) ; } ========================================================================== Enjoy! dave decwrl!cookie.dec.com!wecker
dillon@CORY.BERKELEY.EDU (Matt Dillon) (12/14/86)
> 1. The memory usage numbers are in "k" (i.e., 1024 bytes) so > the shell MEM command and this won't appear to agree until > you divide the shell number by 1024 (not 1000). My shell has always and forever will divide the byte count by 1024. There is definately *no* mistake... I use a shift. -Matt
mwm@eris.BERKELEY.EDU (Mike (Don't have strength to leave) Meyer) (12/15/86)
In article <6914@decwrl.DEC.COM> wecker@cookie.dec.com (DAVE CUM GRANO SALIS WECKER) writes: >I thought people might like this... it is a repost of Mike Meyer's clock >program with the following goodies: I don't like it - in fact, I'm royally P.O.'d about it. Dave, in one posting, you've managed to: 1) Break the law. 2) Put *false* words in my mouth, and in so doing 3) Misrepresent my position on PD software. 4) Place my code in the public domain, when I hadn't done so. Let me quote from the initial comment of *MY* version of that program: /* * clock - a dumb, digital clock in the upper right-hand corner. Designed * to be small, not flexible! * * Copyright (c) 1986, Mike Meyer * * Permission is hereby granted to distribute this program for any purposes * whatsoever, so long as this notice, including the above copyright, is * included with the distribution. Unlike other people, I don't care if you * make money off of this, so long as I get credit for having written it. */ Now, let's see what's left of this in the version Dave posted: >/* clock - a dumb, digital clock in its own window > * > * original: Mike Meyer - public domain, not for sale > * v1.1: Dave Wecker - under Manx, auto change of timings, no printf > * > */ Firstly, my copyright notice has disappeared. Since permission to redistribute was granted ON THE CONDITION that it not disappear, you've broken the law. I'll concede that this is a shaky copyright notice, but that's not a good reason for doing what you did. Second, the words "public domain" and "not for resale" are incompatable. If something is not for resale, it can't be in the public domain. Likewise, if it's in the public domain, anyone can do whatever they wish with it, including compile it and sell the binaries as their own. Third, I specifically said that I don't care if other people resell the thing. You attached the "not for sale" to my name, implying that I said it. I would never say any such thing, as 1) it's not legally possible to do that, and 2) I disagree with the sentiments expressed. Finally, since you left off the copyright notice, failed to add your own, and distributed the code on a public network, you've placed it in the public domain. Thus anyone who wants to can legally compile it and sell the binaries, without every mentioning my name - or yours, for that matter. You obviously did a significant (compared to the work I originally put into it) amount of work on the code (you also left a construct in it that's illegal under ANSI C). There's a way to indicate this, and have your wish that it not be resold indicated, that is both legally and morally correct. Namely, you add your own copyright line, and then say "May not be sold, or included as part of any package which is sold." or words to that affect. We'd both hold copyright on the resulting program, and anyone who wished to do something with it under conditions other than those in the copyright notice would have to get in touch with both of us. Dave, this action is, as far as I'm concerned, indistinguishable from that of people who sell code that's marked "public domain, not for sale." True, you haven't made any money; but they haven't broken the law. The important thing in both cases is that you've violated the express wishes of the authors of the code. It's that kind of thing that makes people stop making programs publicly available. Dave, if you got a copy of the program from someone else who had stripped my copyright notice off, I apologize. I'm still P.O.'d, but don't know who did it. In that case, I'd appreciate help in finding the culprit, so I can properly vent my wrath at them. <mike
andy@cbmvax.cbm.UUCP (Andy Finkel) (12/17/86)
In article <1936@jade.BERKELEY.EDU> mwm@eris.BERKELEY.EDU (Mike (Don't have strength to leave) Meyer) writes: >In article <6914@decwrl.DEC.COM> wecker@cookie.dec.com (DAVE CUM GRANO SALIS WECKER) writes: >>I thought people might like this... it is a repost of Mike Meyer's clock >>program with the following goodies: > >I don't like it - in fact, I'm royally P.O.'d about it. Dave, in one >posting, you've managed to: > I'm not a lawyer, but I've talked to many on this since it seems to be a concern to most software authors and companies. So I'd like to make the following statements: (not in order) > 4) Place my code in the public domain, when I hadn't done so. He hasn't done this...even though the copy was distributed without a notice, your copyright is still valid. All he could do is place his own code in public domain. If anyone could put anyone else's work into public domain just by publishing it without a copyright notice, copyrights wouldn't last long. You might have to take some action, however, to protect your copyrights > 1) Break the law. Probably true, but also probably unintentionally. > 2) Put *false* words in my mouth, and in so doing > 3) Misrepresent my position on PD software. >Firstly, my copyright notice has disappeared. Since permission to >redistribute was granted ON THE CONDITION that it not disappear, >you've broken the law. I'll concede that this is a shaky copyright >notice, but that's not a good reason for doing what you did. As far as I can tell, your original copyright is prefectly fine in its intent, and wording. >Dave, this action is, as far as I'm concerned, indistinguishable from >that of people who sell code that's marked "public domain, not for >sale." There's no such thing as "public domain, not for sale." Either it is Public Domain, which means any member of the public is free to do anything to it, including sell it, or it is copyrighted (possibly freely redistributable). This difference is important! > <mike (remember, not a lawyer...) andy finkel -- andy finkel Commodore/Amiga {ihnp4|seismo|allegra}!cbmvax!andy or pyramid!amiga!andy Any expressed opinions are mine; but feel free to share. I disclaim all responsibilities, all shapes, all sizes, all colors. "Never make anything simple and efficient when it can be complex and wonderful."
keithe@tekgvs.UUCP (Keith Ericson) (12/17/86)
In article <1936@jade.BERKELEY.EDU> mwm@eris.BERKELEY.EDU (Mike (Don't have strength to leave) Meyer) writes: >>I thought people might like this... it is a repost of Mike Meyer's clock >>program with the following goodies: > >I don't like it - in fact, I'm royally P.O.'d about it. Dave, in one >posting, you've managed to... [...really screw up]: I've deleted the article from the machines I'm responsible for. (.signature included as "50% new material" padding) keith Keith Ericson at TekLabs (resident factious factotum) Tektronix, PO 500, MS 58-383 Beaverton OR 97077 (503)627-6042 uucp: [ucbvax|decvax|ihnp4|hplabs|(and_many_others)]!tektronix!tekgvs!keithe CSnet: keithe%tekgvs@tektronix ARPAnet: keithe%tekgvs%tektronix@csnet-relay "Modern" version: keithe@tekgvs.tek.com
hutch@sdcsvax.UCSD.EDU (Jim Hutchison) (12/18/86)
Mike, I have inserted an effective message as to your intent, in my copy (in case I sent it out). If you could post the copyright notice so that the rest of us could do likewise, it would no doubt be appreciated. I have no intention of purging source. I will maintain your claim to fortune and glory (as is your right). -- As usual, I am on my own in this posting, and represent no one but my self. -- Jim Hutchison UUCP: {dcdwest,ucbvax}!sdcsvax!hutch ARPA: Hutch@sdcsvax.ucsd.edu Fig is a 5 stage concept.