From: owner-csmp@ee.mcgill.ca Subject: csmp digest Vol 4 No 041 Today's Topics: CMM SDK Current Timezone ? Hierarchical menu? Macintosh Audio Compression Metrowerks Code warrior Microseconds Pageflipping on the Mac? Question: Fast Disk Read SetCursor and cursor management TextEdit and arrow keys [Q] OS8 Headers [Q]: Changing textfonts of dialog items [Q]Finding trap names... cron on a mac? gmake or nmake for the Mac? how to get SIOUX to be more like a thread? The Comp.Sys.Mac.Programmer Digest is moderated by Mark Aiken (marka@ee.mcgill.ca). The digest is a collection of article threads from the internet newsgroups comp.sys.mac.programmer.help, csmp.tools, csmp.misc and csmp.games. It is designed for people who read news semi-regularly and want an archive of the discussions. If you don't know what a newsgroup is, you probably don't have access to it. Ask your systems administrator(s) for details. If you don't have access to news, you may still be able to post messages to the group by using a mail server like anon.penet.fi (mail help@anon.penet.fi for more information). Each issue of the digest contains one or more sets of articles (called threads), with each set corresponding to a 'discussion' of a particular subject. The articles are not edited; all articles included in this digest are in their original posted form (as received by our news server at ee.mcgill.ca). Article threads are not added to the digest until the last article added to the thread is at least two weeks old (this is to ensure that the thread is dead before adding it to the digest). Article threads that consist of only one message are generally not included in the digest. The digests can be obtained by email, ftp or through the World Wide Web. If you want to receive the digest by mail, send email to majordomo@ee.mcgill.ca with no subject and one of the following commands as body: help Sends you a summary of commands subscribe csmp Adds you to the mailing list unsubscribe csmp Removes you from the list Once you have subscribed, you will automatically receive each new issue as it is created. Back issues are available by ftp from Info-Mac mirror sites in the per/csmp subdirectory, e.g. ftp://sumex-aim.stanford.edu/info-mac/per/csmp/ The contents of all back issues can be searched by accessing the following URL, courtesy of Andrew Barry (ajbarry@ozemail.com.au): http://marvin.stattech.com.au/search.html They can also be searched through the following URLs, thanks to Tim Tuck (Tim.Tuck@sensei.com.au): http://wais.sensei.com.au/searchform.html wais://wais.sensei.com.au:210/csmp? ------------------------------------------------------- >From sdussin@dgs.dgsys.com Subject: CMM SDK Date: Fri, 19 Sep 1997 15:21:54 -0600 Organization: Deja News Posting Service Does anyone out there know where I can get the Contextual Menu Manager SDK? I've looked in the devworld section at ftp.apple.com, but I can't seem to find it... Thanx, Steve - -----------------==== Posted via Deja News ====----------------------- http://www.dejanews.com/ Search, Read, Post to Usenet +++++++++++++++++++++++++++ >From trygve@bombaydigital.com (Trygve Isaacson) Date: Fri, 19 Sep 1997 16:17:29 -0700 Organization: Bombay Digital In article <874700064.31346@dejanews.com>, sdussin@dgs.dgsys.com wrote: >Does anyone out there know where I can get the Contextual Menu Manager >SDK? I've looked in the devworld section at ftp.apple.com, but I >can't seem to find it... Here: http://devworld.apple.com/MacOS8/index.html http://devworld.apple.com/MacOS8/Contextual_Menus.sea.hqx Good luck, Trygve Isaacson +++++++++++++++++++++++++++ >From sgraff@dnai.com (Steve Graff) Date: Sat, 20 Sep 1997 22:34:46 -0700 Organization: DNAI ( Direct Network Access ) In article <874700064.31346@dejanews.com>, sdussin@dgs.dgsys.com wrote: > Does anyone out there know where I can get the Contextual Menu Manager > SDK? I've looked in the devworld section at ftp.apple.com, but I > can't seem to find it... Steve Graff sgraff@dnai.com http://www.dnai.com/~sgraff --------------------------- >From kent@kagi.removethis.com (Kent Sorensen) Subject: Current Timezone ? Date: Mon, 22 Sep 1997 11:10:31 -0700 Organization: North Bay Network, Inc. news server - not responsible for content Is there a documented way to get at the values specified by the user in the Map control panel, especially the current TimeZone ? I have found an old MacTech article describing how to do it by reading the PRAM, but would prefer a more direct way... Kent Sorensen +++++++++++++++++++++++++++ >From brian_hall@markspace.com (Brian Hall) Date: Mon, 22 Sep 1997 16:04:08 -0700 Organization: Mark/Space Softworks In article , kent@kagi.removethis.com (Kent Sorensen) wrote: > Is there a documented way to get at the values specified by the user in > the Map control panel, especially the current TimeZone ? > > I have found an old MacTech article describing how to do it by reading the > PRAM, but would prefer a more direct way... Memory is foggy, but I think it can be computed from GetMachineLoc -- _____________________________________________________________________ Mark/Space Softworks voice 408-293-7299 111 West Saint John, 4th Floor fax 408-293-7298 San Jose, CA 95113 Mac OS, Newton, Windows and Web Communications Software & Solutions: PageNOW!, PageME!, Communicate, ZMODEM, PC-ANSI, Videotex CTB Tools +++++++++++++++++++++++++++ >From jude@smellycat.com (Jude Giampaolo) Date: Tue, 23 Sep 1997 09:43:16 -0400 Organization: CyberDrugs In article , kent@kagi.removethis.com (Kent Sorensen) wrote: > Is there a documented way to get at the values specified by the user in > the Map control panel, especially the current TimeZone ? Yes there is (I'm not sure if this 100% correct, but it works for me): var theLocation : MachineLocation; tz_seconds : longint; { Get the latitude, longitude and time zone from the OS } ReadLocation(theLocation); { Check to see if the latitude, longitude, etc. are valid. If they have } { Never been set they all default to zero, so that is the condidition } { we check for. } with theLocation do begin if (latitude=0) and (longitude=0) and (gmtDelta=0) then begin {no timezone set, default to something reasonable} tz_seconds:=DEFAULT_TIME_ZONE * 3600; end else begin {This is messy because the time zone offset is a 3 byte integer } tz_seconds:=BAND(gmtDelta,$00FFFFFF); {check to see if we need to sign extend} if BTST(tz_seconds,23) then tz_seconds:=BOR(tz_seconds,$FF000000); end; end; tz_seconds now contains the UTC delta to the current timezone in seconds. -- Jude Giampaolo -- Penn State University -- Electrical Engineering jcg161@psu.edu - jude@smellycat.com - http://prozac.cwru.edu/jude/ +++++++++++++++++++++++++++ >From skovatch@metrowerks.dot.com (Scott Kovatch) Date: Tue, 23 Sep 1997 16:31:12 -0500 Organization: Metrowerks Corp. In article , kent@kagi.removethis.com (Kent Sorensen) wrote: >Is there a documented way to get at the values specified by the user in >the Map control panel, especially the current TimeZone ? > >I have found an old MacTech article describing how to do it by reading the >PRAM, but would prefer a more direct way... Check out Inside Macintosh: OS Utils. It documents how to get the time zone. Also, here's a routine I used to get the timezone for our VM. static char * GetTimeZone() { char * retstr = nil; MachineLocation theLoc; float delta; // Float for places like Newfoundland ReadLocation(&theLoc); if (theLoc.latitude == 0 && theLoc.longitude == 0 && theLoc.u.gmtDelta == 0) { delta = 0.0; retstr = "GMT"; } else { long offset; short i; offset = theLoc.u.gmtDelta & 0x00FFFFFF; if (offset & (1 << 23)) { offset |= 0xFF000000; } // The GMT delta is in seconds, so for hours, divide by 3600. delta = offset / (60 * 60); // Allow for daylight savings time. if (theLoc.u.dlsDelta < 0) delta += -1.0; else if (theLoc.u.dlsDelta > 0) delta += 1.0; // sTimezoneTable is a table of float/string pairs so you get an ISO(?) // abbreviation for the timezone. Let me know if you want it. Delta may // be enough for what you're doing. // Convert delta to timezone string. for (i = 0; sTimezoneTable[i].offset != 99.0; i++) { if (sTimezoneTable[i].offset == delta) { retstr = sTimezoneTable[i].timezone; break; } } // If we can't find it for some reason, use GMT. if (retstr == NULL) { retstr = "GMT"; } } return retstr; } - ----------------------------------------------------------------- Scott Kovatch Java Engineer Metrowerks Corp. skovatch@metrowerks.com --------------------------- >From roov@pitango.com (Reuven J. Sherwin) Subject: Hierarchical menu? Date: Fri, 12 Sep 1997 10:57:10 +0300 Organization: Pitango Multimedia Ltd. Hi there, I'm looking for sample code for creating hierarchical menus, _dynamically_. Non of the menus exists as resources, and the number of sub menus is unknown. Can anyone out there help? Thanks, Reuven -- __________________________________________________________________________ Reuven J. Sherwin roov@pitango.com Pitango Multimedia Ltd. www.pitango.com "Everything ought to be turned upside down occasionally; it lets in air and light." - Betty Sorenson, "Star Beast", R.A.H. +++++++++++++++++++++++++++ >From DavidO@dascorp.com (David Phillip Oster) Date: Fri, 12 Sep 1997 09:20:18 -0700 Organization: Digital Arts & Sciences Corp. In article , roov@pitango.com (Reuven J. Sherwin) wrote: >Hi there, >I'm looking for sample code for creating hierarchical menus, _dynamically_. >Non of the menus exists as resources, and the number of sub menus is unknown. Well, menus are -required- to be resources. that is what the menuId field is for: the resource id number. I get around this problem by noting that only 5 hierarchical menus can be on screen at a time (menu manager limit) so I create 5 blank menus, assign them custom MDEFS, and do the right thing. When the mouse is over a menu1 hierarchical item, the menu manager puts up menu2. meun2 figures out how big it is and what to draw. When the mouse is over a menu2 hierarchical item, the menu manager puts up menu3, and so on. I use this in a script menu that allows nested folders, with aliases to scripts and aliases to folders. Unfortunately, I cannot share this code. I can share this, however: In Spetember 1990, I asked Apple Tech support how custom menus could support hierarchical sub menus without flicker. Here is the reply: - -------------- begin quote The way the standard MDEF and MBDF handle hierarchical menus is one of the weirdest things in the universe. When the mouse moves over a menu item that has a sub menu, you immediately have to tell the MBDF the rectangle of that menu item in screen coordinates (in other words, the rectangle that you¼d invert in reaction to the mouse passing over the menu item). This is done in two locations. One location is the low-memory global called Scratch8 located at $09FA. The other is in the relocatable block of memory called MBSaveLoc which is located at $0B5C. Scratch8 is eight bytes long, so all you have to do there is copy the item¼s rectangle to those eight bytes. MBSaveLoc is a handle to a block of memory that¼s maintained by the standard MBDF. Six bytes from the beginning of this block of memory is a rectangle that should hold the item¼s rectangle. Copy your item¼s rectangle to these eight bytes. So what you would do in your MDEF¼s mChooseMsg code is to check to see if the item the mouse is currently over is active and if it has a sub menu. If both of these are true, copy the item¼s rectangle to Scratch8 and also to the area that¼s six bytes from the beginning of the block of memory specified by the MBSaveLoc handle. Once you do this, that redrawing should go away. (In follow-ups, please refer to „9/10/90 EM 08690¾) ORIGINALLY IN: 07 September 90 TO ENG:10 September 90 OUT:11 September 90 TIME: 08:05 AM Forrest Tanaka Developer Technical Support - -------------- end quote -- -- Warning: posted from an unlocked cubicle: no guarantee its really me. Ahh! The thorazine is wearing off and the odinazine is coming on... +++++++++++++++++++++++++++ >From "Mike Throckmorton" Date: 16 Sep 97 12:22:59 -0400 Organization: Msen David Phillip Oster wrote: >Well, menus are -required- to be resources. that is what the menuId field >is for: the resource id number. Naw. Not really. You can just whomp 'em up with NewMenu and twiddle with them as you please. Mike T. --------------------------- >From James Eoff Subject: Macintosh Audio Compression Date: Thu, 18 Sep 1997 16:38:32 -0700 Organization: University of Washington I need to shave a fair amount of space of of several 8 bit, 22kHz, mono audio files. Is there a compression scheme similar to Microsoft ADPCM available for Mac audio? If not, does anyone have any ideas for reclaiming space without changing the sampling rate, or the sample bit resolution? Please respond by email to : adiranjo@aol.com Thanks, Jim Eoff eMedia Corp. +++++++++++++++++++++++++++ >From michael@nfocomm.com (Michael Connolly) Date: Fri, 19 Sep 1997 13:28:56 -0600 Organization: In article , James Eoff wrote: > I need to shave a fair amount of space of of several 8 bit, 22kHz, mono > audio files. Is there a compression scheme similar to Microsoft ADPCM > available for Mac audio? If not, does anyone have any ideas for > reclaiming space without changing the sampling rate, or the sample bit > resolution? Please respond by email to : > adiranjo@aol.com > > Thanks, > Jim Eoff > eMedia Corp. _Inside Macintosh: Sound_ discusses MACE compression, which offers 3:1 and 6:1 ratios. I think the conversion to and from compressed sound is done on the fly for you. You can get the printed version of the book, published by Addison Wesley, or download a PDF or DocMaker version of it on the Apple FTP site . - -- Michael Connolly - -- Ask about Pseud040, a 68040 emulator for 020's and 030's. Shareware release in about a week! - -- See the CyberJibe (a weekly humor mailing list/ Webzine) home page at . - -- --------------------------- >From David Gillies Subject: Metrowerks Code warrior Date: Wed, 17 Sep 1997 13:21:42 +0100 Organization: University of Bradford I'm about to get myself a new Powermac - a fast one. I need it for software development, in particular C++. So my question is, what sort of spec do I need? Will 64Mb be enough or do I need 128, or more? Will a 200MHz 604e box be adequate, or do I need a G3 machine or say a 9600/350? What about compilers? Is Code Warrior tracking the X3J16/1997 ANSi/ISO standard? I hope so, because this is important. Thanks, -- ______________________________________________________________________ David A. G. Gillies (daggilli@vader.brad.ac.uk) University of Bradford, Bradford, West Yorkshire, England _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ P.S. If you could copy any replies via email I'd be grateful. +++++++++++++++++++++++++++ >From MWRon@metrowerks.com (MW Ron) Date: Wed, 17 Sep 1997 20:55:49 -0400 Organization: Metrowerks In article , j-jahnke@uchicago.edu (Jerome Jahnke) wrote: >What parts of the standard are you interested in. Fer example Metroweks >does not have namespaces or fully realized template support. I know this >because these are the areas I use and need in C++ that they don't have. Coming soon, at least in a Beta form, Drop me a note Jerome if you aren't a beta tester now. Ron -- METROWERKS Ron Liechty http://www.metrowerks.com MWRon@metrowerks.com +++++++++++++++++++++++++++ >From MWRon@metrowerks.com (MW Ron) Date: Wed, 17 Sep 1997 20:54:32 -0400 Organization: Metrowerks In article <341FCB56.4276@vader.brad.ac.uk>, David Gillies wrote: >I'm about to get myself a new Powermac - a fast one. I need it for >software development, in particular C++. So my question is, what >sort of spec do I need? Will 64Mb be enough or do I need 128, or more? >Will a 200MHz 604e box be adequate, or do I need a G3 machine or >say a 9600/350? What about compilers? Is Code Warrior tracking the >X3J16/1997 ANSi/ISO standard? I hope so, because this is important. Of course this all depends on what you are developing for, but 64Mb on a 200MHz machine is great, I'm running a 24MB 601 myself and do fine for most things. Yes Metrowerks is tracking the latest Proposed standards, We have some unimplimented features requireing a few hacks in CW Pro, but they should be solved soon. We are also doing the C9X C additions. Ron -- METROWERKS Ron Liechty http://www.metrowerks.com MWRon@metrowerks.com +++++++++++++++++++++++++++ >From ngauger@execpc.com (Anon y. mous) Date: 18 Sep 1997 12:48:05 GMT Organization: Exec-PC BBS Internet - Milwaukee, WI Codewarrior is humming away on my 68040 with 12 megs of RAM and off a zip drive, so I don't think you need that much computer. ngauger@execpc.com +++++++++++++++++++++++++++ >From cgh@ednet.co.uk (Colin Hall) Date: Sat, 20 Sep 1997 09:02:46 +0000 Organization: Ednet David Gillies wrote: > I'm about to get myself a new Powermac - a fast one. I need it for > software development, in particular C++. So my question is, what > sort of spec do I need? Will 64Mb be enough or do I need 128, or more? > Will a 200MHz 604e box be adequate, or do I need a G3 machine or > say a 9600/350? I use a 7500/100 with 64MB RAM and Metrowerks CodeWarrior Pro 1. I think the 200MHz 604e box will be enough. You should get 64Mb RAM but more would not be necessary. Spend the money on L2 cache. I write medium sized commercial applications for the Mac. Typically they take ten minutes for a complete build from scratch including precompiling the headers. If I have just edited some source files, a compile of the affected files and linking typically takes more than 30 secs and less than a minute. Keep file sharing off!!!! > What about compilers? Is Code Warrior tracking the > X3J16/1997 ANSi/ISO standard? I hope so, because this is important. Metrowerks is the best offering at present, thought they are a little behind in standards compliance. If the ability to run a compliant compiler matters most, you should not be buying a Mac running MacOS. If having a Mac matters most then you will have to accept the pace of compiler development for this platform. Best Regards, Colin Hall. - ------------------------------------------------------------------ Colin Hall, Design Engineer. email: cgh@ednet.co.uk Edinburgh, Tel: +44 (0131) 228 1562 Scotland, UK Fax: +44 (0131) 228 1562 --------------------------- >From David Cohn Subject: Microseconds Date: Thu, 18 Sep 1997 11:26:03 +0000 Organization: Eyebright Interactive I am trying to convert a UNIX procedure to MacOS which provides the current date as seconds __and microseconds__ since 1970. The problem on the MacOS is that I cannot get the microseconds portion of the date. Since "Microseconds" is usecs since __startup__, I can't synch the usecs portion to the GetDateTime function. Is there any way on the Mac to get the date and time including usecs, or to synch the Microseconds timer to the Date? +++++++++++++++++++++++++++ >From RVerlinde@arnhem.alva-bv.nl (Reinder Verlinde) Date: Fri, 19 Sep 1997 09:19:05 +0200 Organization: ALVA B.V. In article <34210FC2.6A34@sirius.com>, dhc@sirius.com wrote: >I am trying to convert a UNIX procedure to MacOS which provides the >current date as seconds __and microseconds__ since 1970. > > The problem on the MacOS is that I cannot get the microseconds portion >of the date. Since "Microseconds" is usecs since __startup__, I can't >synch the usecs portion to the GetDateTime function. > >Is there any way on the Mac to get the date and time including usecs, or >to synch the Microseconds timer to the Date? I do not think there is a 'proper' way to do this. The clock hardware probably does not even count microseconds. The way I would do it is: call GetDateTime and MicroSeconds closely together, and declare the result of the MicroSeconds trap to be exactly the time GetDateTime returned. From that time on, call MicroSeconds, subtract what MicroSeconds returns from that initial value, and add the number of seconds from 1970 to what GetDateTime returned to get a new time. If you want to be fancy, you can call GetDateTime in a loop, waiting for a one-second jump in time (you might even try to compensate for the time difference between calling GetDateTime and MicroSeconds, just in case you are running a 50kHz Mac), but I do not think it is worth the effort (the clock usually is not running that precise, anyway) Reinder -- Reinder Verlinde +++++++++++++++++++++++++++ >From David Cohn Date: Fri, 19 Sep 1997 12:08:46 +0000 Organization: Eyebright Interactive Reinder Verlinde wrote: > > I do not think there is a 'proper' way to do this. The clock hardware > probably does not even count microseconds. The way I would do it is: > > call GetDateTime and MicroSeconds closely together, and declare the result > of the MicroSeconds trap to be exactly the time GetDateTime returned. From > that time on, call MicroSeconds, subtract what MicroSeconds returns from > that initial value, and add the number of seconds from 1970 to what > GetDateTime returned to get a new time. > > If you want to be fancy, you can call GetDateTime in a loop, waiting for a > one-second jump in time (you might even try to compensate for the time > difference between calling GetDateTime and MicroSeconds, just in case you > are running a 50kHz Mac), but I do not think it is worth the effort (the > clock usually is not running that precise, anyway) > Thanks for your response... I actually tried both methods you mentioned before posting, and in each case there is enough of an inaccuracy to not allow these methods for interval timing calls. First I just called GetDateTime and MicroSeconds together, and used the first MicroSeconds value as a base for future usec calculations. Without timing for the second-jump, however, there was a significant chance that future timing calls would return a lower usec count than previous ones. Then I wrote the tight-loop code you mentioned (waiting for the second-jump), and that decreased the chances quite a bit. However, there was still about a 10-20 usec inconsistency. If I could accurately gauge the time taken for the two trap calls, I may be able to bridge this gap, but that would either be CPU dependent, or require a very accurate timer of the type I'm trying to implement! I could call MicroSeconds before and after the GetDateTime call, and average the difference, but still I can't convince myself this would be totally accurate. Again, I appreciate your thoughts on this... any further thoughts? I'm thinking I may just have to write two sets of timing functions, one for date and one for usecs, and change the initial code base somewhat (bummer!). --Dave +++++++++++++++++++++++++++ >From jthill@netcom.com (Jim Hill) Date: Fri, 19 Sep 1997 13:57:09 -0700 Organization: biological <-- hey! a one-word oxymoron! David Cohn wrote: > Is there any way on the Mac to get the date and time including usecs, or > to synch the Microseconds timer to the Date? Sure: call GetDateTime() and Microseconds() at startup, and from then on use the delta from the startup Microseconds() to the current Microseconds() as an offset from the startup GetDateTime(). For accuracy you could average the Microseconds() returns just before and after GetDateTime() changes in a tight loop at startup, but I think that would be serious overkill unless you're synced to an NTP server. This does still have the usual wall-clock-reset problems (daylight savings and such). Depending on your needs, you might want to check for those by also calling GetDateTime() and verifying that the differences match (to within say a tick or two of the difference at startup) - if they don't, somebody's reset the clock and you get to decide what to do about that. Ooooh, goodygoodygoody, I just _love_ clock weirdities. This is through my hat, so I posted it too to catch any idiocies. Jim -- Jim Hill jthill@netcom.com PGP 0x00AE8B09 / 6B8576D1 EFBA2C78 12258A5A BFF3377E +++++++++++++++++++++++++++ >From David Cohn Date: Fri, 19 Sep 1997 15:30:59 +0000 Organization: Eyebright Interactive Hmmm... I think you both were right. I was using the Microseconds call to determine the usecs portion of the time only. If I use it as an offset from startup time, it should be accurate to within 2 seconds as far as real time goes, and avoids the problem of having to measure the "seconds jump." Sorry about the lapse of comprehension there... thanks for your help! --Dave +++++++++++++++++++++++++++ >From "Paulo Casanova" Date: Sun, 21 Sep 1997 19:21:02 +0000 Organization: Instituto Superior Tecnico > From: David Cohn > Newsgroups: comp.sys.mac.programmer.help > Subject: Re: Microseconds > Date: Fri, 19 Sep 1997 12:08:46 +0000 > >Reinder Verlinde wrote: >> >> I do not think there is a 'proper' way to do this. The clock hardware >> probably does not even count microseconds. The way I would do it is: >> >> call GetDateTime and MicroSeconds closely together, and declare the result >> of the MicroSeconds trap to be exactly the time GetDateTime returned. From >> that time on, call MicroSeconds, subtract what MicroSeconds returns from >> that initial value, and add the number of seconds from 1970 to what >> GetDateTime returned to get a new time. >> >> If you want to be fancy, you can call GetDateTime in a loop, waiting for a >> one-second jump in time (you might even try to compensate for the time >> difference between calling GetDateTime and MicroSeconds, just in case you >> are running a 50kHz Mac), but I do not think it is worth the effort (the >> clock usually is not running that precise, anyway) >> > >Thanks for your response... > >I actually tried both methods you mentioned before posting, and in each >case there is enough of an inaccuracy to not allow these methods for >interval timing calls. First I just called GetDateTime and MicroSeconds >together, and used the first MicroSeconds value as a base for future >usec calculations. Without timing for the second-jump, however, there >was a significant chance that future timing calls would return a lower >usec count than previous ones. > >Then I wrote the tight-loop code you mentioned (waiting for the >second-jump), and that decreased the chances quite a bit. However, >there was still about a 10-20 usec inconsistency. If I could accurately >gauge the time taken for the two trap calls, I may be able to bridge >this gap, but that would either be CPU dependent, or require a very >accurate timer of the type I'm trying to implement! I could call >MicroSeconds before and after the GetDateTime call, and average the >difference, but still I can't convince myself this would be totally >accurate. > >Again, I appreciate your thoughts on this... any further thoughts? >I'm thinking I may just have to write two sets of timing functions, one >for date and one for usecs, and change the initial code base somewhat >(bummer!). Well... statistics are very usefull in this case. - ---------------------------------------------------- Some theoric statistical discussion If you wait for GetDateTime to change and count the microsecond "offset" a few times (you must have a reasonable number of times to ensure the Central Limit Theorem warrants you that the mean is normally distributed), supposing you want to determine the "offset" with p confidence you would have: P{|m-r| P{-i < m-r < i}=p <=> <=> P{-i n/s < (m-r)n/s < i n/s}=p <=> <=> P{(m-r)n/s < i n/s} - P{(m-r)n/s < -i n/s}=p <=> <=> P{(m-r)n/s < i n/s} = (p + 1)/2 where n is the square root of the number of samples and s the corrected standard deviation of the samples. Since (m-r)n/s has t distribution with n^2 - 1 degrees of freedom you just need to go to a table and get the value of n to ensure that the mean you have is correct. - --------------------------------------- Now the practical stuff: You can make it like this: make some sampling (start by 50 offsets, for example). Compute the corrected standard deviation. Compute 0.5 * n / s. (n is the square root of the number of samples - 50 and s is the corrected standard deviation). Compute the probability of a t-distributed function random variable being less than 0.5 * n / s. Compute p = 2*computed probability - 1. Check p agains the confidence level you want. If it is smaller make more sampling. Here is some code: double ComputeOffset( double precision, double confidence ) { double s = 0; // standard deviation double m = 0; // mean int n = 0; // number of samples double var; double t, p; do { Sample( &m, &s, &n ); var = precision * sqrt( n ) / s; t = ComputeT( var ); p = 2*t - 1; } while( p < confidence ); return m; } void Sample( double *m, double *s, int *n ) { double m2, new_m; double s2, new_s; int n2; int i; int offsets[SAMPLE_LENGTH]; // Sample length can be, for example, 50 // sample SAMPLE_LENGTH offsets to the "offsets" array. n2 = SAMPLE_LENGTH; for( i = 0, m2 = 0; i < n2; i++ ) m2 += offsets[i], offsets[i] *= offsets[i]; m2 /= n2; for( i = 0, s2 = 0; i < n2; i++ ) s2 += offsets[i]; s2 -= n2 * m2 * m2; s2 /= (n2 - 1); if( *n == 0 ) { new_m = m2; new_s = s2; } else { new_m = (*m * *n + m2 * n2)/(*n + n2); new_s = (*n - 1) * (*s) / ((*n) + n2 - 1) + (n2 - 1) * s2 / ((*n) + n2 - 1) + (n2 * m2 * m2 + (*n) * (*m) * (*m) - (n2 + (*n)) * new_m * new_m; // I hope I have this right!!! } *n += n2; *m = new_m; *s = new_s; } A FEW VERY IMPORTANT NOTES: This routine only works if a) The offset is time-invariant (the *real* offset must be a constant number - although we can (and will) measure different values). b) You must sample a big number of offsets. In theory, this computations will only be correct for n = infinity. Actually, only for n = infinity (m-r)sqrt(n)/s has a t distribution. For a finite n (which is the case) it will have aproximately a t distribution. The greater n is, the better this aproximation is. If you have a small n, a "tight" confidence interval and a small precision, you must start by sampling a big n. I suggest that you use SAMPLE_LENGTH as 100 (or more) and then you can have precision = 0.5 and confidence = 0.99 (99%). This routine will return you the offset which is guaranteed that, in 99% of the cases, is the correct offset +- 0.5 usecs. You can have, for example, precision = 0.01 and confidence = 0.9999 (99.99%) but in that case a much higher n is required. For such case, I suggest n >= 1000. If you do so, you know that in 99.99% of the cases the returned average is the correct offset +- 0.01 usecs. I hope this is usefull. It might be somehow complicated to someone that is unfamiliar with statistics... if you need help, e-mail me: l41188@alfa.ist.utl.pt (the first character is an L) Paulo Casanova --------------------------- >From girschik@igd.fhg.de (Martin Girschick) Subject: Pageflipping on the Mac? Date: Thu, 28 Aug 1997 14:58:26 +0200 Organization: FhG-IGD Hi! I'm writing some fullscreen applications like a screensaver and a 3d game. For that I'm using offscreen buffers which have to be blitted to the screen all the time. This uses some performance, what I don't like. >From DOS computers or the Apple ][ I know the technique of page flipping. There you have two or more graphic pages, which can be activated to be displayed on the screen. This switching takes no cpu time. and that's what I think would be cool. Does anyone know whether this technique is available on the Mac, or at least on my PowerMac 7500/100? Thanx in advance, Patrick. +++++++++++++++++++++++++++ >From demon@news.loop (The Anonymous Mouse) Date: Wed, 10 Sep 1997 17:22:42 +0000 Organization: The Cheese Factory I used to use the technique on the Atari ST, setting the screen address. I asked many years ago if this could be done on the Mac and was told not, I did try it anyway and never had any success. CopyBits or your own custom routine will have to do. You can ensure Copybits works at its fastest by ensuring source and destination rects/depths are same.Also set foreground to black and background to white when copying. If I remember correctly it works best when rowBytes is a multiple of four. Check out Inside MAc for more info, but some results are usable. After all play some of the 3D type games that allow you to 'use CopyBits' and the speed is still fast. A firend does a lot of mac graphic code and he swears by direct to screen adressing. In article <19970828145826196990@maccoy.igd.fhg.de>, girschik@igd.fhg.de (Martin Girschick) wrote: > Hi! > > I'm writing some fullscreen applications like a screensaver and a 3d > game. For that I'm using offscreen buffers which have to be blitted to > the screen all the time. This uses some performance, what I don't like. > From DOS computers or the Apple ][ I know the technique of page > flipping. There you have two or more graphic pages, which can be > activated to be displayed on the screen. This switching takes no cpu > time. and that's what I think would be cool. Does anyone know whether > this technique is available on the Mac, or at least on my PowerMac > 7500/100? > > Thanx in advance, > > Patrick. -- Reply to: The anonymous mouse. anonymouse@mindless.com +++++++++++++++++++++++++++ >From GUDATH@EZINFO.VMSMAIL.ETHZ.CH (Henrik 'Ratte' Gudat) Date: 11 Sep 1997 07:52:17 GMT Organization: Synergetix > In article <19970828145826196990@maccoy.igd.fhg.de>, girschik@igd.fhg.de > (Martin Girschick) wrote: > > time. and that's what I think would be cool. Does anyone know whether > > this technique is available on the Mac, or at least on my PowerMac > > 7500/100? I was told that some Macs do support page flipping, for example the 7100AV. I don't know how but according to a friend you can split the video buffer into two chunks. (I believe the AV card puts back one buffer for buffering incoming video or whatever, and you can use that for your own stuff.) Not that it's of any use - you would have to mess with the video card pretty directly and are extremely limited in the matter of compatibility. - henrik +++++++++++++++++++++++++++ >From Paolo Bertani Date: Thu, 18 Sep 1997 19:26:01 +0000 Organization: Ye 'Ol Disorganized NNTPCache groupie > I used to use the technique on the Atari ST, setting the screen address. > > I asked many years ago if this could be done on the Mac and was told not, I > did try it anyway and never had any success. > CopyBits or your own custom routine will have to do. PageFlipping can be done on macs but only on those models that have certain video cards installed. Check out Apple Game Sprockets it is a set of APIs to help programmes develop games. One of them, DrawSprocket, let you hide menu-bar, fade-out, blitting and, of course page-flipping. If page-flipping isn't supported in the machine your app is running on it is emulated via very fast blitters. Go to the apple developer site and search for the sprockets. Bye, Paolo. --------------------------- >From Kadri Jabri Subject: Question: Fast Disk Read Date: Thu, 18 Sep 1997 19:28:08 -0500 Organization: Case Western Reserve University, Cleveland OH (USA) What is the fastest way to read large binary files (>20Mb) stored sequentially on disk? I am using a PowerMac 9500/200 and a 10,000 rpm Ultra Wide SCSI hard disk (seagate). When I test the drive using MacBench, it can achieve a sustained read speed greater than 10Mb/sec. However, when I write C code and read from the disk using "fread", it barely achieves 4Mb/sec. I suppose "fread" is not the fastest way to read in binary files. Is there a faster way? Are there any C libraries (free or not) that I can use to read from the disk faster? I appreciate any suggestions. Kadri Jabri +++++++++++++++++++++++++++ >From rang@trillium.adaptec.com (Anton Rang) Date: Thu, 18 Sep 1997 21:07:52 -0500 Organization: Adaptec Trillium Development Center In article <3421C778.2254@po.cwru.edu>, knj2@po.cwru.edu wrote: > What is the fastest way to read large binary files (>20Mb) stored > sequentially on disk? The fastest way is to use a low-level call, such as PBRead, disable the file system cache, do it asynchronously if there's anything useful you can do while the read is happening, and read as much as possible in one call. > I am using a PowerMac 9500/200 and a 10,000 rpm Ultra Wide SCSI hard > disk (seagate). When I test the drive using MacBench, it can achieve a > sustained read speed greater than 10Mb/sec. However, when I write C code > and read from the disk using "fread", it barely achieves 4Mb/sec. The C file I/O routines tend to be very slow because they often don't read data directly into the user's buffer: they read it into a private buffer (in small blocks, which is bad) and then copy it to the right place (also bad). I'd recommend using the high-level FSRead call -- it's pretty easy and will give you much better performance than what you're getting now. If you're doing something like processing video in real time, you'll probably still want to use asynchronous calls to get the best performance. Hope this helps, -- Anton +++++++++++++++++++++++++++ >From blob@apple.BOGUS.com (Brian Bechtel) Date: Fri, 19 Sep 1997 09:06:01 -0700 Organization: Apple Computer, Inc. -- DTS In article <3421C717.60BE@po.cwru.edu>, knj2@po.cwru.edu wrote: > What is the fastest way to read large binary files (>20Mb) stored > sequentially on disk? See technote FL 16, "File System Peformance and Caching" at -- --Brian Bechtel to respond, remove the characters ".BOGUS" from my address +++++++++++++++++++++++++++ >From grayowl@sover.net (Gray Owl Software) Date: Sun, 21 Sep 1997 17:50:13 -0400 Organization: SoVerNet, Inc. In article <3421C717.60BE@po.cwru.edu>, knj2@po.cwru.edu wrote: > What is the fastest way to read large binary files (>20Mb) stored > sequentially on disk? > > I am using a PowerMac 9500/200 and a 10,000 rpm Ultra Wide SCSI hard > disk (seagate). When I test the drive using MacBench, it can achieve a > sustained read speed greater than 10Mb/sec. However, when I write C code > and read from the disk using "fread", it barely achieves 4Mb/sec. > > I suppose "fread" is not the fastest way to read in binary files. Is > there a faster way? Are there any C libraries (free or not) that I can > use to read from the disk faster? Try the File manager call ::FSRead() for starters...then you can try one of the lower-level PBxxxx calls to do the reading and see if it makes a difference. If you haven't worked with these before, you'll need to look at the File Manager sections of Inside Macintosh. Vinay Prabhakar Gray Owl Software --------------------------- >From dstone@BIT.chem.utoronto.ca (David Stone) Subject: SetCursor and cursor management Date: 17 Sep 1997 12:33:57 GMT Organization: University of Toronto Chemistry When you call SetCursor(), does the operating system copy the actual data, or just the CursPtr? Background: my application uses several of the system cursors as well as some custom ones, and I'm trying to fine tune cursor management through the WNE loop. I'm not sure whether it's better to (a) load all the cursors at startup, (b) load each one only when needed (in response to cursor moved event), or (c) load, call SetCursor and then ReleaseResource in order to keep heap fragmentation down. The program does a lot of number crunching on large 1- and 2-dimensional arrays, so keeping memory tidy is somewhat of a concern. Thanks in advance, David Stone (remove the obvious bit to reply...) +++++++++++++++++++++++++++ >From erkyrath@netcom.com (Andrew Plotkin) Date: Wed, 17 Sep 1997 18:59:57 GMT Organization: Netcom On-Line Services David Stone (dstone@BIT.chem.utoronto.ca) wrote: > When you call SetCursor(), does the operating system copy the > actual data, or just the CursPtr? It copies the actual data. So yes, you can release the CURS resource safely, or make it purgeable. With color cursors, the situation is a bit different; you can't dispose the CCrsrHandle while the cursor is on-screen. However, the actual 'crsr' resource is loaded by GetCCursor and not needed after that. So you can make the resource purgeable. --Z -- "And Aholibamah bare Jeush, and Jaalam, and Korah: these were the borogoves..." --------------------------- >From weber@fas.harvard.edu (Griffin Weber) Subject: TextEdit and arrow keys Date: Thu, 18 Sep 1997 23:01:55 -0500 Organization: Harvard I've been using TextEdit routines to allow users to enter data into my program. However, something strange is happening whenever I try to move the cursor with the arrow keys. If I type a few lines of text, move the cursor to some random location within the paragraph, and then repeatedly press the left arrow, the cursor should move one character at a time, eventually reaching the very left edge of the line before going back up to the preceding line. Often (I can't make it happen every time), however, the cursor will skip the first character in the line, never stopping at the left edge. Although I can't reproduce this in most applications, I can make it occur quite often in even the newest versions of SimpleText. Does anyone know what's going on? If so, how do most programs get around this problem? Thanks. +++++++++++++++++++++++++++ >From sdudley@yesic.com (Steve Dudley) Date: Sun, 21 Sep 1997 10:56:07 -0400 Organization: none In article , weber@fas.harvard.edu (Griffin Weber) wrote: > I've been using TextEdit routines to allow users to enter data into my > program. However, something strange is happening whenever I try to move > the cursor with the arrow keys. If I type a few lines of text, move the > cursor to some random location within the paragraph, and then repeatedly > press the left arrow, the cursor should move one character at a time, > eventually reaching the very left edge of the line before going back up to > the preceding line. Often (I can't make it happen every time), however, > the cursor will skip the first character in the line, never stopping at > the left edge. Although I can't reproduce this in most applications, I can > make it occur quite often in even the newest versions of SimpleText. Does > anyone know what's going on? If so, how do most programs get around this > problem? Thanks. I think the problem is that the end of one line has the same cursor position as the start of the next. As IM VI p.15-14 ff. says "...the line where the caret is displayed depends on the current caret position and the value in the clikStuff field in the edit record. TextEdit sets this field to reflect whether the most recent mouse-down event occurred on the leading or trailing edge of a character." Two approaches: 1) You can try fiddling with clikStuff. This won't give you separate caret positions at the ends and starts of lines, as in most word-processors, but at least you can have consistent caret placement. 2) Rewrite TextEdit from scratch. Most (probably all) word-processors do this, but it's usually overkill for simple data entry. Anybody have better solutions? Steve --------------------------- >From GOJO@MSG.TI.COM (JOE GILBERT) Subject: [Q] OS8 Headers Date: 10 Sep 1997 13:18:32 GMT Organization: (none) Hi All, I was just wondering: what good are the new OS8 Contextual Menu and Appearance headers that you can get from Apple's developer site, without any code implementation? I would like to start using some of the API but there don't seem to be any libraries yet. Have I missed something? TIA, James +++++++++++++++++++++++++++ >From jac@igor.caltech.edu (Jeff Clites) Date: Sat, 13 Sep 1997 01:24:00 -0700 Organization: California Institute of Technology, Pasadena In article <5v66n8$r12@sf18.dseg.ti.com>, GOJO@MSG.TI.COM (JOE GILBERT) wrote: >I was just wondering: what good are the new OS8 Contextual Menu and Appearance >headers that you can get from Apple's developer site, without any code >implementation? I would like to start using some of the API but there don't >seem to be any libraries yet. Have I missed something? The Appearance and Contextual Menu extensions come installed by default with OS8, so I don't think you need any additional libraries. - ------------------------------------------------------------------------ Jeff Clites Pasadena, California My account name is jac and the rest of my address has igor and caltech and edu, separated by dots. Don't spam me or anybody else (please). +++++++++++++++++++++++++++ >From jharvey@mail.airmail.net (James Harvey) Date: Sun, 14 Sep 1997 17:33:24 -0500 Organization: INTERNET AMERICA In article , don_arb@wolfenet.com (Don Arbow) wrote: >In article , >jac@igor.caltech.edu (Jeff Clites) wrote: > >: In article <5v66n8$r12@sf18.dseg.ti.com>, GOJO@MSG.TI.COM (JOE GILBERT) >: wrote: >: >: : I was just wondering: what good are the new OS8 Contextual Menu and >: : Appearance headers that you can get from Apple's developer site, >: : without any code implementation? I would like to start using some >: : of the API but there don't seem to be any libraries yet. >: : Have I missed something? >: >: The Appearance and Contextual Menu extensions come installed by default >: with OS8, so I don't think you need any additional libraries. >: > > >Except that you need library stubs to weak link against when you compile >your project. > >The June 1997 issue of MacTech described the new Appearance Manager >interface. They also provided a package at their web site that contained >an AppearanceLib stub file, but it was an alpha version. > >Don > >-- >Don Arbow, Partner, CTO >EveryDay Objects, Inc. >don_arb@wolfenet.com <-- remove underscore to reply >http://www.edo-inc.com Thanks Don. It looks like it may be a while before we get anything from Apple that can be linked with PPC code. This really makes it hard for people who program primarily for the PPC :(. +++++++++++++++++++++++++++ >From don_arb@wolfenet.com (Don Arbow) Date: Sun, 14 Sep 1997 20:23:22 -0700 Organization: None In article <90E25530CCD460D2.D5AE9E7C36B314C9.2243C82088882C7C@library-proxy.airnews.net>, jharvey@mail.airmail.net (James Harvey) wrote: : In article , : don_arb@wolfenet.com (Don Arbow) wrote: : : >In article , : >jac@igor.caltech.edu (Jeff Clites) wrote: : > : >: In article <5v66n8$r12@sf18.dseg.ti.com>, GOJO@MSG.TI.COM (JOE GILBERT) : >: wrote: : >: : >: : I was just wondering: what good are the new OS8 Contextual Menu and : >: : Appearance headers that you can get from Apple's developer site, : >: : without any code implementation? I would like to start using some : >: : of the API but there don't seem to be any libraries yet. : >: : Have I missed something? : >: : >: The Appearance and Contextual Menu extensions come installed by default : >: with OS8, so I don't think you need any additional libraries. : >: : > : > : >Except that you need library stubs to weak link against when you compile : >your project. : > : >The June 1997 issue of MacTech described the new Appearance Manager : >interface. They also provided a package at their web site that contained : >an AppearanceLib stub file, but it was an alpha version. : > : >Don : > : >-- : >Don Arbow, Partner, CTO : >EveryDay Objects, Inc. : >don_arb@wolfenet.com <-- remove underscore to reply : >http://www.edo-inc.com : : Thanks Don. It looks like it may be a while before we get anything from : Apple that can be linked with PPC code. This really makes it hard for : people who program primarily for the PPC :(. I found the Universal Interfaces 3.0.1 package from Apple's developer site. It contains a stub library for the Appearance Manager. You can find it at: http://gemma.apple.com/dev/sdk.html Don -- Don Arbow, Partner, CTO EveryDay Objects, Inc. don_arb@wolfenet.com <-- remove underscore to reply http://www.edo-inc.com +++++++++++++++++++++++++++ >From don_arb@wolfenet.com (Don Arbow) Date: Sat, 13 Sep 1997 13:48:08 -0700 Organization: None In article , jac@igor.caltech.edu (Jeff Clites) wrote: : In article <5v66n8$r12@sf18.dseg.ti.com>, GOJO@MSG.TI.COM (JOE GILBERT) : wrote: : : : I was just wondering: what good are the new OS8 Contextual Menu and : : Appearance headers that you can get from Apple's developer site, : : without any code implementation? I would like to start using some : : of the API but there don't seem to be any libraries yet. : : Have I missed something? : : The Appearance and Contextual Menu extensions come installed by default : with OS8, so I don't think you need any additional libraries. : Except that you need library stubs to weak link against when you compile your project. The June 1997 issue of MacTech described the new Appearance Manager interface. They also provided a package at their web site that contained an AppearanceLib stub file, but it was an alpha version. Don -- Don Arbow, Partner, CTO EveryDay Objects, Inc. don_arb@wolfenet.com <-- remove underscore to reply http://www.edo-inc.com +++++++++++++++++++++++++++ >From 3gl21@qlink.queensu.ca Date: Thu, 18 Sep 1997 18:40:58 -0400 Organization: Queen's University, Kingston In article , don_arb@wolfenet.com (Don Arbow) wrote: >jharvey@mail.airmail.net (James Harvey) wrote: >: In article , >: don_arb@wolfenet.com (Don Arbow) wrote: >: >In article , >: >jac@igor.caltech.edu (Jeff Clites) wrote: >: >: The Appearance and Contextual Menu extensions come installed by default >: >: with OS8, so I don't think you need any additional libraries. >: >Except that you need library stubs to weak link against when you compile >: >your project. >: >The June 1997 issue of MacTech described the new Appearance Manager >: >interface. They also provided a package at their web site that contained >: >an AppearanceLib stub file, but it was an alpha version. >: Thanks Don. It looks like it may be a while before we get anything from >: Apple that can be linked with PPC code. This really makes it hard for >: people who program primarily for the PPC :(. I've often found that you can weak-link directly against the CFM fragments in the extensions and distribution shared libraries themselves. That's what CFM ends up doing anyway. GLo --------------------------- >From k.m.g.m.vanderdrift@ams.chem.ruu.nl (Koen van der Drift) Subject: [Q]: Changing textfonts of dialog items Date: Tue, 09 Sep 1997 15:06:45 +0200 Organization: Not Before Lunch Hello, I want some of my dialog items to have a font different from the system font. I found some code in 'snippets', but this changes all items, and not just the one(s) you want. It also does not change radiobutton titles. How can I change only the item(s) I want? TIA, - Koen. - ------------------------------------------------------------ Koen van der Drift Mass Spectrometry, Utrecht University, the Netherlands http://www.chem.ruu.nl/amsmass/www/amsmass.html +++++++++++++++++++++++++++ >From jbackes@ricochet.net (Jeffrey G. Backes) Date: 10 Sep 1997 01:03:01 -0700 Organization: GlobalCenter, Inc. If you use Resourcer, it can update another "linked" dialog resource that controls the type styles for each item individual. I think it's the 'ICTB' but don't quote me... There is no REZ compatible way of doing this that I know of. jeff In article , k.m.g.m.vanderdrift@ams.chem.ruu.nl (Koen van der Drift) wrote: > Hello, > > I want some of my dialog items to have a font different from the system > font. I found some code in 'snippets', but this changes all items, and not > just the one(s) you want. It also does not change radiobutton titles. How > can I change only the item(s) I want? > > TIA, > > - Koen. > > -------------------------------------------------------------- > Koen van der Drift > Mass Spectrometry, Utrecht University, the Netherlands > > http://www.chem.ruu.nl/amsmass/www/amsmass.html +++++++++++++++++++++++++++ >From k.m.g.m.vanderdrift@ams.chem.ruu.nl (Koen van der Drift) Date: Wed, 10 Sep 1997 13:50:01 +0200 Organization: Not Before Lunch In article , jbackes@ricochet.net (Jeffrey G. Backes) wrote: >If you use Resourcer, it can update another "linked" dialog resource that >controls the type styles for each item individual. I think it's the 'ICTB' Is there any information available on (the use of) that resource in one of the IM books? - Koen. - ------------------------------------------------------------ Koen van der Drift Mass Spectrometry, Utrecht University, the Netherlands http://www.chem.ruu.nl/amsmass/www/amsmass.html +++++++++++++++++++++++++++ >From jbackes@ricochet.net (Jeffrey G. Backes) Date: 10 Sep 1997 16:24:01 -0700 Organization: GlobalCenter, Inc. Inside Macintosh - Macintosh Toolbox Essentials Page 6-158 Jeff In article , k.m.g.m.vanderdrift@ams.chem.ruu.nl (Koen van der Drift) wrote: > In article , > jbackes@ricochet.net (Jeffrey G. Backes) wrote: > > >If you use Resourcer, it can update another "linked" dialog resource that > >controls the type styles for each item individual. I think it's the 'ICTB' > > Is there any information available on (the use of) that resource in one of > the IM books? > > - Koen. > > -------------------------------------------------------------- > Koen van der Drift > Mass Spectrometry, Utrecht University, the Netherlands > > http://www.chem.ruu.nl/amsmass/www/amsmass.html +++++++++++++++++++++++++++ >From zmike_throckmorton@compuserve.com Date: 15 Sep 97 07:25:28 -0400 Organization: Msen Koen van der Drift: > Is there any information available on (the use of) that resource in one of > the IM books? > > - Koen. > I don't know the answer to _that_, but I would definitely recommend getting Resorcerer and just letting it do the work. Unless of course, for some reason, you need to build these resources on the fly... You wouldn't regret the purchase regardless, as Resorcerer is an unbelievably useful tool, in general. Mike T. +++++++++++++++++++++++++++ >From fahl@dataton.se (Mike Fahl) Date: Tue, 16 Sep 1997 23:13:19 +0200 Organization: Dataton =?ISO-8859-1?Q?=AD=A0TRUE?= MULTIMEDIA wrote: > I don't know the answer to _that_, but I would definitely recommend getting > Resorcerer and just letting it do the work. Unless of course, for some > reason, you need to build these resources on the fly... Keep in mind that there are two different ways to set the font, depending on the kind of dialog item. For text items, you can specify font, size, color, etc using the ictb resource. For other items, you can usually tell the control to use the current window font (rather then the system font). You must then also convince the dialog window to use the desired font. Whether the ictb method works also depends on the presence of color quickdraw, so this method doesn't work for very old black&white Macs (Plus, SE, PB100, etc). Mike Fahl - -------------- Dataton - TRUE MULTIMEDIA integration and show control systems. Check it out at http://www.dataton.com --------------------------- >From Studio C Subject: [Q]Finding trap names... Date: Wed, 03 Sep 1997 04:18:22 -0400 Organization: Crosstown Audio, Inc. Hello, I'm trying my hand at writing my first system extension that patches some traps involved with D&D. My problem lies in trying to determine the names of the traps to patch. I tried using Macsbug's ATR ON to record some D&D behavior and then hopefully find the trap names by using ATP but that didn't seem to do it.(the results of ATP didn't make sense) Is there a common approach I'm missing to finding trap names or are they documented somewhere? Thanks for your time. Nick Ketter Sr. Engineer Crosstown Audio,Inc. Sound for Picture in AtlantaÆ +++++++++++++++++++++++++++ >From shapiro@@aol.com (Eric Shapiro) Date: Mon, 15 Sep 1997 22:55:37 -0400 Organization: Relium Corp. In article <340D1D4E.241@mindspring.com>, xtownaud@mindspring.com wrote: > I'm trying my hand at writing my first system extension that patches > some traps involved with D&D. > I tried using Macsbug's ATR ON to record > some D&D behavior and then hopefully find the trap names by using ATP > but that didn't seem to do it. Look at the header file you need -- in this case, it is . You should see the trap number after the routine name (along with some 68K machine code bytes). The trap number is 0xABED and a selector of some sort is pushed onto the stack, I think. You can see exactly what happens by creating a 68K project that calls the drag mgr and then tell CodeWarrior to disassemble the code. I'm not sure if patching the trap is enough, though. PowerPC apps link to the Drag Mgr shared library file which may bypass the trap mechanism. (It's been a while since I did this, so my memory is a little hazy). I think patching will work. -Eric +++++++++++++++++++++++++++ >From phils@metrowerks.com (Phil Shapiro) Date: Tue, 16 Sep 1997 11:55:34 -0400 Organization: Metrowerks, Inc In article , shapiro@@aol.com (Eric Shapiro) wrote: | In article <340D1D4E.241@mindspring.com>, xtownaud@mindspring.com wrote: | | > I'm trying my hand at writing my first system extension that patches | > some traps involved with D&D. | | > I tried using Macsbug's ATR ON to record | > some D&D behavior and then hopefully find the trap names by using ATP | > but that didn't seem to do it. Maybe the application you were trying to watch is native -- native calls to native (or fat) traps won't appear in the a-trap log, since they don't use the a-trap dispatch mechanism. | Look at the header file you need -- in this case, it is . | You should see the trap number after the routine name (along with | some 68K machine code bytes). | | The trap number is 0xABED and a selector of some sort is pushed | onto the stack, I think. You can see exactly what happens by | creating a 68K project that calls the drag mgr and then tell | CodeWarrior to disassemble the code. An even easier way to do this is to use the "dh" (disassemble hex) command in MacsBug. It lets you enter in a sequence of machine instructions as hex and shows you what they disassemble to. For example in Drag.h you have: extern pascal OSErr TrackDrag(DragReference theDragRef, const EventRecord *theEvent, RgnHandle theRegion) TWOWORDINLINE(0x700D, 0xABED); If you enter MacsBug and type "dh 700d abed" you get: MOVEQ #$0D,D0 _TrackDrag Note that the a-trap is really _DragDispatch but MacsBug is clever and looks at the preceeding instruction to tell which dispatched trap the code is using. | I'm not sure if patching the trap is enough, though. PowerPC | apps link to the Drag Mgr shared library file which may bypass | the trap mechanism. (It's been a while since I did this, so my | memory is a little hazy). I think patching will work. Yes, if you patch a native trap with a 68k patch, the native code in InterfaceLib will end up using the a-trap dispatcher to call your patch. This is why non-native patches to native (or fat) traps can cause the system to slow down. -phil -- Phil Shapiro Metrowerks, Inc phils@metrowerks.com --------------------------- >From Arne.Venstad@itea.ntnu.no (Arne Venstad) Subject: cron on a mac? Date: Fri, 05 Sep 1997 08:01:57 +0100 Organization: University of Trondheim - ITEA Is it possible to make an Apple script that behaves as a cron demon on a Macintosh? We would like to have such a demon automatically restart an application or the finder itself e.g. once a day. -- Arne Venstad Email: Arne.Venstad@itea.ntnu.no ITEA Phone: 73593018 (office) Norwegian University Fax: 73598098 of Science and Technology +++++++++++++++++++++++++++ >From Joseph Santaniello Date: Fri, 05 Sep 1997 09:30:10 +0200 Organization: SOL Internett Hei Arne, There is a program called cron for Mac which is a port of the unix version. So you can use that if you want. It's available someplace in the ftp info-mac mirror at mac.uio.no. Or write an AppleScript to do it. use the idle() function to wait 12 hours or something before quitting and restarting whatever apps you want. e-mail me if you need help. Joe -- Joseph Santaniello +47 22 36 45 43 Wilses Gt. 2 cvoss@online.no N-0178 Oslo Jofish@Mindless.com ØØØØØØØØØØØØØØØØØØØØØØØØØØØØØØØØØØØØØØØØØØØØØØ http://www.sn.no/~cvoss/software/ ______________________________________________ +++++++++++++++++++++++++++ >From Terje Bless Date: 08 Sep 1997 11:22:40 +0000 Organization: University of Tromsoe, Norway In article <340FB502.7EB7@Mindless.com>, Joseph Santaniello wrote: >There is a program called cron for Mac which is >a port of the unix version. That sounds like Chris Johnson`s () Cron application (). It`s not really a port of the UNIX version, but rather a "reimplementation" of UNIX cron on Mac OS. Download from -- Party? Party, lord? Yes, lord. Right away, lord. - Beopunk Cyberwulf +++++++++++++++++++++++++++ >From spam@blah.blah.blah.in.sig (John C Daub) Date: Mon, 15 Sep 1997 10:19:11 -0500 Organization: Metrowerks Corporation In article , Arne.Venstad@itea.ntnu.no (Arne Venstad) wrote: >Is it possible to make an Apple script that behaves as a cron >demon on a Macintosh? We would like to have such a demon >automatically restart an application or the finder itself >e.g. once a day. I've actually seen some cron implementations on info-mac. You might want to check that out. This can be done via AppleScript, but something tells me that using a native cron application would be faster and more flexible. -- - -------------------------------------------------------------------- John C. Daub Metrowerks Engineering Operations PowerPlant/Latitude Minion PGP Public Key Available +++++++++++++++++++++++++++ >From gregb@nospam.jps.net (Greg Branche) Date: Thu, 18 Sep 1997 17:59:52 -0700 Organization: Apple Computer, Inc. In article , Arne.Venstad@itea.ntnu.no (Arne Venstad) wrote: >Is it possible to make an Apple script that behaves as a cron >demon on a Macintosh? We would like to have such a demon >automatically restart an application or the finder itself >e.g. once a day. I've used this: and then written an AppleScript, saved it as an application, and then had Cron launch it nightly (it was part of a build system). Worked pretty well for me. Greg Branche MPW Entomologist Apple Computer, Inc. - --- (Note: perform a spam-ectomy on my return address for direct mail.) --------------------------- >From nicky@talkway.com (Nick Pilch) Subject: gmake or nmake for the Mac? Date: Tue, 16 Sep 1997 12:18:53 -0700 Organization: Talkway, Inc. Does anyone know of a version of nmake (Windows) or gmake (GNU's make) that has been ported to the Mac as an MPW tool? I can get the sources from GNU, but I fear building it will not be a simple task. Thanks for any pointers/hints. -- Nick Pilch / nicky@talkway.com +++++++++++++++++++++++++++ >From Matthias Neeracher Date: 16 Sep 1997 21:56:56 +0200 Organization: Integrated Systems Laboratory, ETH, Zurich nicky@talkway.com (Nick Pilch) writes: > Does anyone know of a version of nmake (Windows) or gmake (GNU's make) > that has been ported to the Mac as an MPW tool? I can get the sources from > GNU, but I fear building it will not be a simple task. Thanks for any > pointers/hints. What I can offer you is dmake, available at: Matthias - --- Matthias Neeracher http://www.iis.ee.ethz.ch/~neeri "Thou shalt not answer questionnaires // Or quizzes upon world affairs, Nor with compliance // Take any test. Thou shalt not sit with statisticians nor commit // A social science." -- W.H. Auden, _Under which lyre_ --------------------------- >From Andrew Subject: how to get SIOUX to be more like a thread? Date: Tue, 23 Sep 1997 10:32:32 -0400 Organization: Case Western Reserve University, Cleveland OH (USA) Hi, I do mostly ANSI C++ numerical code development on a Unix machine, but lately my office computer has been giving me trouble so I have been developing on my Mac. Anyhow, when I run numerical code with a SIOUX window, it essentially takes up 100% of the processor and my machine will not respond to any other events. That is a problem when runtimes can go on for hours. I know a little about Mac OS programming, and I know that Mac is not a threaded OS, so I was wondering if anyone could tell me how I can get my machine to be more resonsive while it is grinding away at integrals and whatnot. If this is an involved question, maybe someone could direct me to a good reference. Thanks for any help. -- To reply remove the "SPAMSUX" from my e-mail address. Andrew +++++++++++++++++++++++++++ >From Serge Droz Date: Tue, 23 Sep 1997 11:52:42 -0400 Organization: University of Guelph There is no super simple way of doing it. However the F2C people have developed a simple mechanism to kind of implement multi tasking. Check the F2C stuff on the CD (Just the multitasking stuff should be enough). Essentially you have to include one function call into every loop you spend significant time in. However if you do other things you loose a lot of speed. Alternatively install linux or the BeOS on your machine. (They both do not need too much disk space). These OS's are both threaded and both support gnu cc. Cheers Serge -- Serge Droz http://jovian.physics.uoguelph.ca/~droz/uni/ Department of Physics mailto:droz@physics.ualberta.ca University of Guelph, Phone Office: (519) 824-4120 x8301 Guelph, Ont, Canada N1G 2W1 Home: (519) 836-6076 +++++++++++++++++++++++++++ >From DavidO@dascorp.com (David Phillip Oster) Date: Tue, 23 Sep 1997 09:55:34 -0700 Organization: Digital Arts & Sciences Corp. In article <3427D300.41C6@po.cwru.edu>, Andrew wrote: >Hi, > I do mostly ANSI C++ numerical code development on a Unix machine, >but lately my office computer has been giving me trouble so I have been >developing on my Mac. Anyhow, when I run numerical code with a SIOUX >window, it essentially takes up 100% of the processor and my machine >will not respond to any other events. That is a problem when runtimes >can go on for hours. I know a little about Mac OS programming, and I >know that Mac is not a threaded OS, so I was wondering if anyone could >tell me how I can get my machine to be more resonsive while it is >grinding away at integrals and whatnot. If this is an involved >question, maybe someone could direct me to a good reference. Thanks for >any help. A good way of doing it is to find the innermost loop of your program, and put just outside it: (That way, it will be called frequently, but not too frequently) - --------------------------- static unsigned long then; unsigned long now now = TickCount(); if(6 < now - then || now < then){ SIOUXHandleOneEvent(nil); then = TickCount(); } - --------------------------- Discussion: TickCount() counts 60 times a second. if more than 6 ticks have passed, or TickCount() has overflowed, then ask SIOUX to check for events. This will also let other programs run. This strategy will allow other programs to run 10 times a second. If other programs aren't responsive enough, change the 6 in the above example to a smaller number. Even 1 is useful, since a recent posting to comp.risks dempnstrated that modern macs can call TickCount() more than 32,767 times in a single tick of the clock. -- -- Warning: posted from an unlocked cubicle: no guarantee its really me. Ahh! The thorazine is wearing off and the odinazine is coming on... --------------------------- End of C.S.M.P. Digest **********************