From: owner-csmp@ugrad.ece.mcgill.ca Subject: csmp digest Vol 4 No 047 C.S.M.P. Digest Tue, 30 Dec 97 Volume 4 : Issue 47 Today's Topics: Applic. creator registration where? Audio Frequencies Question Checking modifiers without GetNextEvent? Draw Text Vertically Functional prog languages on the Mac? Getting HD Capacity > 2GIG Hiding menu bar Need blitting advice. Need format of Apple 80-bit Extended data type Patching traps (OS-traps & with routine selector) Q: Appearance manager? Q: How to tell if a volume is local or network? QuickTime in offscreen GWorlds... RAVE SDK? Saving into document resource fork ShowDragHilite with non-white backgrounds Toolbox call for "Progress bar dialog" ? What Macsbug with system 8 When to close an open file? [Q] Low level disk access on large drives [Q] Page Flipping _vAdjEOF - why am I dying here? launching an application? read clock for less than one second ? serial port question under interrupt ? utility to send ASCII commands on serial port 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 David Niemeijer Subject: Applic. creator registration where? Date: Mon, 24 Nov 1997 10:25:14 +0100 Organization: Wageningen Agricultural University Hi, I have written an application that I want to distribute on the net. Where can I register my application's 4-letter creator code with Apple? Thanks, David Niemeijer +++++++++++++++++++++++++++ >From dont@spam.com (Zoltan Paulinyi) Date: Sat, 29 Nov 1997 18:49:43 -0200 Organization: PROjECT z In article , i'm@not.here (Jeff Clites) wrote: > In article <347947FA.22FE@rcl.wau.nl>, DNiemeijer@rcl.wau.nl wrote: > > >I have written an application that I want to distribute on the net. > >Where can I register my application's 4-letter creator code with Apple? > > I believe that if you go to www.devworld.com there is a link under one of > the popup menus to the left of the page. If it isn't there, I know there > is a link from one of the pages describing their various developer > membership programs. > > -------------------------------------------------------------------------- > 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). Here it is the homepage: http://devworld.apple.com/dev/cftype/main.html By the way, after registering your signature, you will enter in a homepage about licensing your software. Can you send me the link? I've lost it between the zillions of pages from Apple! -- Zoltan Paulinyi http://www.fisica.ufmg.br/~paulinyi --------------------------- >From "Marc Page" Subject: Audio Frequencies Question Date: 12 Dec 97 15:04:16 -0600 Organization: National Instruments, Austin, TX This should be an easy one. What are the frequencies of the musical notes (ie. A B C D E F G) and how does a sharp or flat affect it. From one octave to another is just doubling or halfing the frequency, if I remember correctly, but I couldn't find the frequency for Conert A, or remember the relationship between the notes. Thanks. PS. Please email me any response. Thanks. - ------------------------------------------------------------------ - Marc Page http://www.ridgenet.net/~mackays/pages.cgi - ------------------------------------------------------------------ 640K ought to be enough for anybody. - Bill Gates, 1981 - ------------------------------------------------------------------ This message was created and sent using the Cyberdog Mail System - ------------------------------------------------------------------ +++++++++++++++++++++++++++ >From reekes@[noSpam]apple.com (Jim Reekes) Date: Fri, 12 Dec 1997 16:05:11 -0900 Organization: Apple Computer, Inc. In article , "Marc Page" wrote: >This should be an easy one. Not really. Get a book and start reading. >What are the frequencies of the musical notes >(ie. A B C D E F G) and how does a sharp or flat affect it. From one >octave to another is just doubling or halfing the frequency, if I remember >correctly, but I couldn't find the frequency for Conert A, or remember the >relationship between the notes. Thanks. Each step on the western tone scale is based on the 12th root of 2. This is called equal temperment. Jim -- Jim Reekes, Polterzeitgeist Sound Manager Expert, QuickTime Products R&D Sound Manager Web Page can be found at: http://quicktime.apple.com/dev/devsnd.html "All opinions expressed are mine, and do not necessarily represent those of my employer, Apple Computer Inc." +++++++++++++++++++++++++++ >From DavePeck Date: Sat, 13 Dec 1997 23:31:24 -0400 Organization: cs/51 Hi There, "A" above middle "C" is 440Hz exactly. To go up an octave, double the frequency. To go down, take half the frequency. To go up/down a half-step, multiply/divide your frequency by the twelfth root of two. (2^(1/12)) -dave +++++++++++++++++++++++++++ >From dont@spam.com (Zoltan Paulinyi) Date: Mon, 15 Dec 1997 14:54:41 -0200 Organization: PROjECT z >What are the frequencies of the musical notes Given a frequency, a half-tone is twelfth root of two (#define'd in Inside Mac: Sound, and I think it is on ) times this frequency. -- Zoltan Paulinyi http://www.fisica.ufmg.br/~paulinyi --------------------------- >From David Niemeijer Subject: Checking modifiers without GetNextEvent? Date: Sun, 07 Dec 1997 11:57:37 +0100 Organization: Wageningen Agricultural University Hi, Can anyone tell me whether there is another way to find out which modifier keys are down besides GetNextEvent, WaitNextEvent and GetKeys? Certain applications change the shape of the cursor when a modifier is pressed (for instance Photoshop changes its spyglass cursor to one with a 'minus' sign when the option key is down) without apparently using GetNextEvent or GetKeys to find out which modifiers are on. Any tips or hints are welcome. Thanks, David Niemeijer DNiemeijer@rcl.wau.nl +++++++++++++++++++++++++++ >From parkerc@cs.rpi.edu (Chris Parker) Date: Sun, 07 Dec 1997 06:39:51 -0500 Organization: Design Conference Room, RPI David - Off the top of my head, I think if you pass a null event mask to OSEventAvail, it'll come back with all modifiers, etc. for you. But that's off the top of my head. It's 6:40 EST and my head could be out of whack. _Chris In article <348A8120.57BF@rcl.wau.nl>, DNiemeijer@rcl.wau.nl wrote: > Hi, > > Can anyone tell me whether there is another way to find out which > modifier keys are down besides GetNextEvent, WaitNextEvent and GetKeys? > > Certain applications change the shape of the cursor when a modifier is > pressed (for instance Photoshop changes its spyglass cursor to one with > a 'minus' sign when the option key is down) without apparently using > GetNextEvent or GetKeys to find out which modifiers are on. > > Any tips or hints are welcome. > > Thanks, > > David Niemeijer > DNiemeijer@rcl.wau.nl -- Chris Parker http://www.cs.rpi.edu/~parkerc/ Research Programmer, Design Conference Room http://www.dcr.rpi.edu/ Rensselaer Polytechnic Institute http://www.rpi.edu/ +++++++++++++++++++++++++++ >From magao@zip.com.au (Timothy C. Delaney) Date: Mon, 08 Dec 1997 22:41:36 +1100 Organization: TCD Software Pty Limited In article <348A8120.57BF@rcl.wau.nl>, DNiemeijer@rcl.wau.nl wrote: > Hi, > > Can anyone tell me whether there is another way to find out which > modifier keys are down besides GetNextEvent, WaitNextEvent and GetKeys? > > Certain applications change the shape of the cursor when a modifier is > pressed (for instance Photoshop changes its spyglass cursor to one with > a 'minus' sign when the option key is down) without apparently using > GetNextEvent or GetKeys to find out which modifiers are on. EventAvail() will work. Or to get the modifiers OSEventAvail() would also work and would be (I think) the fastest method. Any other methods ? -- _/_/_/_/ __| __| _/_| _/_/_/ _/_| _/_/_/ _/_| _/_| _/ _| _/ _/ _| _/ _/ -/ _|_/ _| _/_/_/_| _/ _/_/_/ _/_/_/_| _/ _/ _/ __/ _| _/ _| _/_/_/ _/ _| _/_/_/ Tim Delaney magao@zip.com.au TCD Software Pty Limited http://www.zip.com.au/~magao +++++++++++++++++++++++++++ >From Reinder@arnhem.alva-bv.nl (Reinder Verlinde) Date: Mon, 08 Dec 1997 18:10:58 +0100 Organization: ALVA B.V. In article , magao@zip.com.au (Timothy C. Delaney) wrote: >In article <348A8120.57BF@rcl.wau.nl>, DNiemeijer@rcl.wau.nl wrote: > >> Hi, >> >> Can anyone tell me whether there is another way to find out which >> modifier keys are down besides GetNextEvent, WaitNextEvent and GetKeys? >> >> Certain applications change the shape of the cursor when a modifier is >> pressed (for instance Photoshop changes its spyglass cursor to one with >> a 'minus' sign when the option key is down) without apparently using >> GetNextEvent or GetKeys to find out which modifiers are on. > >EventAvail() will work. Or to get the modifiers OSEventAvail() would also >work and would be (I think) the fastest method. > >Any other methods ? > Check the low-memory copy of GetKeys' result. I believe it is at 0x174 or something like that. This is slightly faster than using GetKeys (and a compatibility risk) Reinder -- Reinder Verlinde +++++++++++++++++++++++++++ >From ALX@ravenware.com (Alex Kinnison) Date: Tue, 09 Dec 1997 00:06:07 -0800 Organization: Ravenware Software In article <348A8120.57BF@rcl.wau.nl>, DNiemeijer@rcl.wau.nl wrote: > Hi, > > Can anyone tell me whether there is another way to find out which > modifier keys are down besides GetNextEvent, WaitNextEvent and GetKeys? Here's a coupla easy macros to do so, using the correct offset to the (still supported) lowmem KeyMap.... #define ModKeys (short) *((short *) 0x17A) #define optionDown (ModKeys & 0x4) #define commandDown (ModKeys & 0x8000) #define controlDown (ModKeys & 0x8) #define shiftDown (ModKeys & 0x1) -- Alex Kinnison ALX@Ravenware.com Terrorist Technical Writing --------------------------- >From naga@ence.kyushu-u.ac.jp (NAGAMINE Yoshihiko) Subject: Draw Text Vertically Date: Fri, 12 Dec 1997 15:23:47 +0900 Organization: Kyushu University, Energy Conversion Engineering Hello. Now I've developed a plotting software on macintosh to visualize our group's calculations. It can display vector and color image for non Euler grid structure's data, that is, particle, FEM, etc. I use Code Warrior 9 for the purpose. Language is C. I have a question. How do i draw a text (or string) vertically ? I think no routines in the Inside Macintosh are avairable. ( may be, QuickDraw GX has the routine. But I don't want to use one.) So are there any reference or source example anywhere ? Does anyone know it ? thanks in advance. - ------------------ NAGAMINE Yoshihiko Kyushu Univ. http://art.ence.kyushu-u.ac.jp/members/nagamine/ -- NAGAMINE Yoshihiko +++++++++++++++++++++++++++ >From ramjet@inforamp.net (Dave Smith) Date: 12 Dec 1997 13:56:50 GMT Organization: Westhead Consulting In article , naga@ence.kyushu-u.ac.jp (NAGAMINE Yoshihiko) wrote: >Hello. Now I've developed a plotting software on macintosh to >visualize our group's calculations. It can display vector and color image >for non Euler grid structure's data, that is, particle, FEM, etc. >I use Code Warrior 9 for the purpose. Language is C. > >I have a question. How do i draw a text (or string) vertically ? >I think no routines in the Inside Macintosh are avairable. >( may be, QuickDraw GX has the routine. But I don't want to use >one.) So are there any reference or source example anywhere ? >Does anyone know it ? I wrote a PowerPlant class that does this, you can probably glean the source you need from this. Check the PowerPlant Class Archive or send me an email and I will email it to you. -- Dave Smith | "And remember, this fix Westhead Consulting & | is only temporary, Barking Spider Software | unless it works" Etobicoke, Ontario | - Red Green CANADA M8W 4S3 (416) 255-3719 +++++++++++++++++++++++++++ >From frankm@and.nl.nospam (Frank Manshande) Date: Tue, 16 Dec 1997 11:54:11 +0100 Organization: AND Publishing Technology BV In article , naga@ence.kyushu-u.ac.jp (NAGAMINE Yoshihiko) wrote: > I have a question. How do i draw a text (or string) vertically ? There is sample code available on Apple's site: http://gemma.apple.com/dev/techsupport/source/SQuickDraw.html You should download the RotateString sample. It uses an offscreen bitmap to display the string in, and then rotates the bitmap and uses copybits to blit it to the screen. Frank Manshande AND Publishing Technology The Netherlands --------------------------- >From uzs90z@ibm.rhrz.uni-bonn.de (Michael Schuerig) Subject: Functional prog languages on the Mac? Date: Sat, 6 Dec 1997 12:47:29 +0100 Organization: Completely Disorganized Can anyone point me to a list of functional programming languages available on the Mac? I'm not in a hurry and I don't intend to do real work in it. My idea is to get a glimpse of another programming style and acquire some new idioms. I've learned Scheme several years ago and although I like it very much I'd prefer something purer this time. Michael -- Michael Schuerig There's a reason for all that rhymes. mailto:uzs90z@uni-bonn.de -Kansas, "Opus Insert" http://www.uni-bonn.de/~uzs90z/ +++++++++++++++++++++++++++ >From jstrout@ucsd.edu (Joseph J. Strout) Date: Mon, 08 Dec 1997 08:17:39 -0800 Organization: UCSD In article <1d0ts5e.10r9eu219wmdfkN@rhrz-isdn3-p39.rhrz.uni-bonn.de>, uzs90z@ibm.rhrz.uni-bonn.de (Michael Schuerig) wrote: >Can anyone point me to a list of functional programming languages >available on the Mac? I'm not in a hurry and I don't intend to do real >work in it. My idea is to get a glimpse of another programming style and >acquire some new idioms. I've learned Scheme several years ago and >although I like it very much I'd prefer something purer this time. Here's one: Python. See http://www.python.org/ for more info. (It's an extremely cool language, BTW, that suffers only from its lack of a decent GUI.) Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Department of Neuroscience, UCSD | | jstrout@ucsd.edu http://www-acs.ucsd.edu/~jstrout/ | `------------------------------------------------------------------' +++++++++++++++++++++++++++ >From uzs90z@ibm.rhrz.uni-bonn.de (Michael Schuerig) Date: Mon, 8 Dec 1997 20:32:00 +0100 Organization: Completely Disorganized Joseph J. Strout wrote: > In article <1d0ts5e.10r9eu219wmdfkN@rhrz-isdn3-p39.rhrz.uni-bonn.de>, > uzs90z@ibm.rhrz.uni-bonn.de (Michael Schuerig) wrote: > > >Can anyone point me to a list of functional programming languages > >available on the Mac? I'm not in a hurry and I don't intend to do real > >work in it. My idea is to get a glimpse of another programming style and > >acquire some new idioms. I've learned Scheme several years ago and > >although I like it very much I'd prefer something purer this time. > > Here's one: Python. See http://www.python.org/ for more info. (It's an > extremely cool language, BTW, that suffers only from its lack of a decent > GUI.) Joe, you're pulling my leg. Python arguably allows an OO programming style, but it quite definitely is not a functional language. I'd prefer a pure FP language. No quibbles, please, about what "pure" means. If I wanted an impure or multi-paradigm language I'd go for Scheme. I want to learn something new. And that doesn't mean practical scripting in Python for now. Michael -- Michael Schuerig Airtight arguments have mailto:uzs90z@uni-bonn.de vacuous conclusions. http://www.uni-bonn.de/~uzs90z/ -Amelie O. Rorty +++++++++++++++++++++++++++ >From Matthias Neeracher Date: 09 Dec 1997 00:05:14 +0100 Organization: Integrated Systems Laboratory, ETH, Zurich uzs90z@ibm.rhrz.uni-bonn.de (Michael Schuerig) writes: > Can anyone point me to a list of functional programming languages > available on the Mac? Well, there are at least two pretty good ML implementations: Caml Light: Standard ML of New Jersey: There are also good Scheme implementations. Matthias - --- Matthias Neeracher http://www.iis.ee.ethz.ch/~neeri "I'm set free to find a new illusion" -- Velvet Underground +++++++++++++++++++++++++++ >From arock@kurango.cit.gu.edu.au (Andrew Rock) Date: 9 Dec 1997 11:11:10 +1000 Organization: Griffith University, CIT uzs90z@ibm.rhrz.uni-bonn.de (Michael Schuerig) writes: > Can anyone point me to a list of functional programming languages > available on the Mac? There is a Mac port of Hugs 1.3 (an interpreter for Haskell) available at: ftp://ftp.cs.chalmers.se/%2fpub/users/nordland/Hugs You will also need a manual and some extra library files etc which you can get from: http://www.cs.nott.ac.uk/Department/Staff/mpj/hugs13/ Cheers, Rock. Andrew Rock -- arock@cit.gu.edu.au -- http://www.cit.gu.edu.au/~arock/ School of Computing and Information Technology Griffith University -- Nathan, Brisbane, Queensland 4111, Australia +++++++++++++++++++++++++++ >From jstrout@ucsd.edu (Joseph J. Strout) Date: Tue, 09 Dec 1997 08:54:39 -0800 Organization: UCSD In article <1d0yhdj.1nktnt51ygztayN@rhrz-isdn3-p20.rhrz.uni-bonn.de>, uzs90z@ibm.rhrz.uni-bonn.de (Michael Schuerig) wrote: >> >Can anyone point me to a list of functional programming languages >> >available on the Mac? >> >> Here's one: Python. See http://www.python.org/ for more info. (It's an >> extremely cool language, BTW, that suffers only from its lack of a decent >> GUI.) > >Joe, you're pulling my leg. Python arguably allows an OO programming >style, but it quite definitely is not a functional language. Hmm, perhaps I'm not clear on the terminology. I thought a functional language was one where functions could be passed as arguments to other functions. And most functional languages also have some sort of "lambda" syntax which allows functions to be built on the fly, and can also execute source code constructed on the fly. Python has all of these attributes. In what way is it not a functional language? Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Department of Neuroscience, UCSD | | jstrout@ucsd.edu http://www-acs.ucsd.edu/~jstrout/ | `------------------------------------------------------------------' +++++++++++++++++++++++++++ >From uzs90z@ibm.rhrz.uni-bonn.de (Michael Schuerig) Date: Tue, 9 Dec 1997 18:14:41 +0100 Organization: Completely Disorganized Joseph J. Strout wrote: > In article <1d0yhdj.1nktnt51ygztayN@rhrz-isdn3-p20.rhrz.uni-bonn.de>, > uzs90z@ibm.rhrz.uni-bonn.de (Michael Schuerig) wrote: > > >> >Can anyone point me to a list of functional programming languages > >> >available on the Mac? > >> > >> Here's one: Python. See http://www.python.org/ for more info. (It's an > >> extremely cool language, BTW, that suffers only from its lack of a decent > >> GUI.) > > > >Joe, you're pulling my leg. Python arguably allows an OO programming > >style, but it quite definitely is not a functional language. > > Hmm, perhaps I'm not clear on the terminology. I thought a functional > language was one where functions could be passed as arguments to other > functions. And most functional languages also have some sort of "lambda" > syntax which allows functions to be built on the fly, and can also execute > source code constructed on the fly. Python has all of these attributes. > In what way is it not a functional language? I don't think the point of a functional language is that it is *possible* to use or fake a particular programming style, but that the language enforces, or at least strongly encourages it. You don't consider C++ a functional language, I bet. Michael -- Michael Schuerig Nothing helps a bad mood like spreading it. mailto:uzs90z@uni-bonn.de -Calvin http://www.uni-bonn.de/~uzs90z/ --------------------------- >From Sean Zabriskie Subject: Getting HD Capacity > 2GIG Date: Tue, 25 Nov 1997 10:43:21 -0800 Organization: Battelle Hi All, I am trying to get the capcity of a 4 Gig Hard Drive using PBHGetVInfo, it seems that I have stumbled into the 2 Gig limit for this function. Does anyone know how to find out the capacity of these drives? I seen it done, I just can't figure out how they're doing it.. Thanks In Advance, Sean Zabriskie sean.zabriskie@pnl.gov +++++++++++++++++++++++++++ >From bhahn@spam-spam.go-away.com (Brendan Hahn) Date: Tue, 25 Nov 1997 17:08:58 -0800 Organization: Transoft Corp In article <347B1C48.4A4F@pnl.gov>, sean.zabriskie@pnl.gov wrote: >I am trying to get the capcity of a 4 Gig Hard Drive using PBHGetVInfo, >it seems that I have stumbled into the 2 Gig limit >for this function. Does anyone know how to find out the capacity of >these drives? I seen it done, I just can't figure out how they're doing >it.. Check the gestaltFSSupports2TBVols bit in gestaltFSAttr to see if large volume support is available. If it is, use the PBXGetVolInfo call with an XVolumeParam to get a 64-bit size. The MoreFiles package from Apple DTS has a function that will do it all for you. bhahn@transoft.mangle.net <-- unmangle to reply +++++++++++++++++++++++++++ >From samizdat@earthlink.net (Chris Kelly) Date: Wed, 26 Nov 1997 01:47:48 GMT Organization: Samizdat Productions Sean Zabriskie wrote: >Hi All, >I am trying to get the capcity of a 4 Gig Hard Drive using PBHGetVInfo, >it seems that I have stumbled into the 2 Gig limit >for this function. Does anyone know how to find out the capacity of >these drives? I seen it done, I just can't figure out how they're doing >it.. >Thanks In Advance, >Sean Zabriskie >sean.zabriskie@pnl.gov See XGetVInfo from MoreFiles. --------------------------- >From shanks@yallara.cs.rmit.edu.au (Vaughan) Subject: Hiding menu bar Date: 8 Dec 1997 04:40:06 GMT Organization: Comp Sci, RMIT University, Melbourne, Australia. Hi! I'm trying to write some code to get rid of the menu bar so I can treat it the same as the rest of the screen, but I'm having some problems compiling the sample code from THINK Reference for this purpose. I can't get the compiler to recognise the global variable 'MBarHeight' (I have #include'd Quickdraw.h and Menus.h). Is there a header file I've forgotten? Could it be that THINK Reference is out of date on this issue? Can anyone suggest an alternative implementation? Thanks in advance for your help! Vaughan :-) +++++++++++++++++++++++++++ >From shapiro@@aol.com (Eric Shapiro) Date: Mon, 08 Dec 1997 01:05:07 -0500 Organization: Relium Corp. In article <66ftn6$lhf$1@goanna.cs.rmit.edu.au>, vs@mindless.com wrote: > purpose. I can't get the compiler to recognise the global variable > 'MBarHeight' (I have #include'd Quickdraw.h and Menus.h). > Is there a header file I've forgotten? > Could it be that THINK Reference is out of date on this issue? A few notes about hiding the menubar: (1) There's sample code at on how to do this. See The sample code didn't look all that great -- it accessed low memory directly rather than using accessor routines, for example. (2) Or look in LowMem.h (or LoMem.h for old compilers) If there are accessor routines you should use them. They would be called something like LMGetMBarHeight() and LMSetMBarHeight(). If you can't find the accessor routines or appropriate #defines in your headers, do the following. #define MBarHeight (*(short*)0xBAA) This isn't as upwardly compatible as using the routines, but works for all current versions of the MacOS. (3) Recent versions of QuickTime have a single routine to hide the menubar. If your app is already using QuickTime, you might as well use the routine. -Eric --------------------------- >From Ian Russell Ollmann Subject: Need blitting advice. Date: Fri, 12 Dec 1997 17:35:40 -0800 Organization: The Scripps Research Institute, La Jolla, CA I've been trying to migrate my app from a model where motion is handled by a double draw with patXOr, to one where the graphics are double buffered using a GWorld and a lot of trips to CopyBits. When I finished and finally got the thing optimized, I found that my drawing routines appear to be out of synch with the screen updates. If you drag around a small simple object such as a rectangle with the mouse, if the the object is near the top of the screen (the screen is important here, not the position relative to the window frame), then everything is fine. The rect nicely follows the mouse around smoothly frame by frame. However towards the bottom of the screen, it seems as though my rect is beating the mouse update to the punch and the rect seems to lead the mouse around the screen by a few pixels. Even worse is there is a (highly variable) region somewhere in the middle of the screen where the rect might appear to be out of synch with itself, and appears to be cut in half at some position as you drag it (the vertical component of the position varies frame by frame). Of course once you let go of the mouse, everything snaps back to normal, but the drag is ugly. I tried adding in a loop to slow down the gfx a bit to see if I could synch it a bit with the screen. I added a line or two to check TickCount() and make sure that I didn't exceed 60 fps. DrawWindow() { if( isNecessary ) UpdateGWorld(); while( TickCount() == gLastTick ) DoNothing(); gLastTick = TickCount(); BlitGWorldToScreen(); } But now the updates look slow and choppy (60 fps is not enough for smooth animation?!) I've seen all sorts of lovely games with animation which appears to be in phase for the whole screen. Is there some trick to achieving that? Is there some way in the MacOS API to get finer time divisions than those provided by TickCount()? Ian Ollmann PM7500/120, MacOS 8.0, 64MB Ram CWPro2, C++, 1024x768@75Hz +++++++++++++++++++++++++++ >From trickys@earthlink.net (Stefan Sinclair) Date: 13 Dec 1997 05:11:20 GMT Organization: EarthLink Network, Inc. At 60fps, you'll be running very close to your monitor's refresh rate (if not over it) so it's not surprising that you are seeing this kind of behavior. What you would need to do to avoid this is to synchronize your code to the monitor's refresh rate. One source of example code on how this can be done is the SpriteWorld sprite animation library. It has some nice functions that can allow one to wait for a monitor to finish updating before drawing, using VBLTasks. That's probably your best bet if you need to eliminate the problem of your drawing getting out of sych or the rectangle being split horizontally. -Stefan On Fri, 12 Dec 1997 17:44:16 -0800, Ian Russell Ollmann wrote: > >I've been trying to migrate my app from a model where motion is handled by >a double draw with patXOr, to one where the graphics are double buffered >using a GWorld and a lot of trips to CopyBits. When I finished and finally >got the thing optimized, I found that my drawing routines appear to be out >of synch with the screen updates. If you drag around a small simple object >such as a rectangle with the mouse, if the the object is near the top of >the screen (the screen is important here, not the position relative to the >window frame), then everything is fine. The rect nicely follows the mouse >around smoothly frame by frame. However towards the bottom of the screen, >it seems as though my rect is beating the mouse update to the punch and >the rect seems to lead the mouse around the screen by a few pixels. Even >worse is there is a (highly variable) region somewhere in the middle of >the screen where the rect might appear to be out of synch with itself, and >appears to be cut in half at some position as you drag it (the vertical >component of the position varies frame by frame). Of course once you let >go of the mouse, everything snaps back to normal, but the drag is ugly. > >I tried adding in a loop to slow down the gfx a bit to see if I could >synch it a bit with the screen. I added a line or two to check TickCount() >and make sure that I didn't exceed 60 fps. > >DrawWindow() >{ > > if( isNecessary ) > UpdateGWorld(); > > while( TickCount() == gLastTick ) > DoNothing(); > gLastTick = TickCount(); > > BlitGWorldToScreen(); >} > >But now the updates look slow and choppy (60 fps is not enough for smooth >animation?!) I've seen all sorts of lovely games with animation which >appears to be in phase for the whole screen. Is there some trick to >achieving that? Is there some way in the MacOS API to get finer time >divisions than those provided by TickCount()? > > Ian Ollmann > > >PM7500/120, MacOS 8.0, 64MB Ram >CWPro2, C++, 1024x768@75Hz > > +++++++++++++++++++++++++++ >From Peter Amberg Date: Tue, 16 Dec 1997 12:10:17 +0100 Organization: Swiss Federal Institute of Technology (ETHZ) Ian Russell Ollmann wrote: > I tried adding in a loop to slow down the gfx a bit to see if I could > synch it a bit with the screen. I added a line or two to check TickCount() > and make sure that I didn't exceed 60 fps. Waiting for 60 ticks to pass does not synchronize drawing to screen really; the 60 ticks may be passed when the vertical retrace is in the middle of the screen. For better results, set up a VBL task. Such a task is called exactly when the screen has been fully redrawn and the vertical retrace is about to start over. In order that you notice your task has executed you need a global counter, short gVBLCount; Inside the VBL task, increase the counter, gVBLCount++; When drawing to the screen, do, gVBLCount = 0; while (gVBLCount == 0); // wait until VBL task expires DrawIt(); Setting up a VBL task correctly might be a bit tricky. Consult a documentation such as THINK Reference or Inside Macintosh. I have found it very hard, though, to make animation perfectly smooth. And remember a VBL task is quite useless if your drawing routine is too slow. /Peter --------------------------- >From matt@sbst.com Subject: Need format of Apple 80-bit Extended data type Date: Wed, 19 Nov 1997 20:02:53 -0600 Organization: Deja News Posting Service Does anyone have the specification of the 80-bit Extended data type (used by c68xxx processors, not PowerPC). Specifically, I'm writing some code on an SGI to read in a .aiff audio file and the sample rate is formatted as an Extended data type and I have no idea how to handle this data. If I had the bit-level description of the data type, I could write my own converter. I searched all over Apple's web site and couldn't find anything (I found the specs for the PowerPC single and double, though). Any help is GREATLY appreciated. Thanks. m - -----------------==== Posted via Deja News ====----------------------- http://www.dejanews.com/ Search, Read, Post to Usenet +++++++++++++++++++++++++++ >From nagle@netcom.com (John Nagle) Date: Thu, 20 Nov 1997 04:58:29 GMT Organization: Netcom On-Line Services matt@sbst.com writes: >Does anyone have the specification of the 80-bit Extended data type (used >by c68xxx processors, not PowerPC). >Specifically, I'm writing some code on an SGI to read in a .aiff audio >file and the sample rate is formatted as an Extended data type and I have >no idea how to handle this data. >If I had the bit-level description of the data type, I could write my own >converter. >I searched all over Apple's web site and couldn't find anything (I found >the specs for the PowerPC single and double, though). It's standard IEEE 80-bit floating point, just like Intel. From the Apple Numerics Manual, 2nd Edition: s Sign bit 1 bit e Biased exponent 15 bits i Explicit one's bit 1 bit f Fraction 63 bits The value v = (-1)^s * 2 ^ (e-16383) * (1.f), provided that i=1. Zero is represented by i=0, f=0, e != 32767. There are various special cases for denormals, NaS, and such. The PowerPC only supports 64 bit floating point, sadly. John Nagle +++++++++++++++++++++++++++ >From dont@spam.com (Zoltan Paulinyi) Date: Tue, 25 Nov 1997 17:42:07 -0200 Organization: PROjECT z In article , nagle@netcom.com (John Nagle) wrote: > matt@sbst.com writes: > >Does anyone have the specification of the 80-bit Extended data type (used > >by c68xxx processors, not PowerPC). > >Specifically, I'm writing some code on an SGI to read in a .aiff audio > >file and the sample rate is formatted as an Extended data type and I have > >no idea how to handle this data. > >If I had the bit-level description of the data type, I could write my own > >converter. > >I searched all over Apple's web site and couldn't find anything (I found > >the specs for the PowerPC single and double, though). > > It's standard IEEE 80-bit floating point, just like Intel. > > From the Apple Numerics Manual, 2nd Edition: > > s Sign bit 1 bit > e Biased exponent 15 bits > i Explicit one's bit 1 bit > f Fraction 63 bits > > The value v = (-1)^s * 2 ^ (e-16383) * (1.f), provided that i=1. > Zero is represented by i=0, f=0, e != 32767. > There are various special cases for denormals, NaS, and such. > > The PowerPC only supports 64 bit floating point, sadly. > > John Nagle I know this "problem" for AIFF sound files. You need to convert extended to long double, in case you are working with PowerPC. Here is how I wrote my code: #if GENERATINGPOWERPC long double temp; x80told(&commonPtr->sampleRate, &temp); sampleRate = temp; #else sampleRate = commonPtr->sampleRate; #endif The program is "AIFF to TEXT Converter", and you can finde the source with it. Best wishes, Zoltan Paulinyi -- Zoltan Paulinyi http://www.fisica.ufmg.br/~paulinyi --------------------------- >From rand@CRM.UMontreal.CA (David Rand) Subject: Patching traps (OS-traps & with routine selector) Date: 2 Dec 1997 20:30:39 GMT Organization: Universite de Montreal I am looking for sample code which illustrates how to 1. patch OS traps; or 2. patch a trap which uses a routine selector I already have several examples of toolbox trap patches without routine selector. I would like to do this in CodeWarrior C, if possible, with or without a little assembly code (preferably without! but I suspect that's not possible). MPW examples would also be useful. Many thanks in advance! David Rand rand@CRM.UMontreal.CA +++++++++++++++++++++++++++ >From i'm@not.here (Jeff Clites) Date: Fri, 05 Dec 1997 00:54:36 -0800 Organization: California Institute of Technology, Pasadena In article <661r5f$28v@epervier.CC.UMontreal.CA>, rand@CRM.UMontreal.CA (David Rand) wrote: >I am looking for sample code which illustrates how to > 1. patch OS traps; or > 2. patch a trap which uses a routine selector > >I already have several examples of toolbox trap patches >without routine selector. I would like to do this in CodeWarrior C, >if possible, with or without a little assembly code (preferably >without! but I suspect that's not possible). MPW examples would >also be useful. Have you seen Extension Shell, on Info-Mac? I'm not sure whether it uses routine selectors, but I thought I'd point it out, just in case. - ------------------------------------------------------------------------ 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 ALX@ravenware.com (Alex Kinnison) Date: Tue, 09 Dec 1997 00:02:46 -0800 Organization: Ravenware Software > In article <661r5f$28v@epervier.CC.UMontreal.CA>, rand@CRM.UMontreal.CA > (David Rand) wrote: > > >I am looking for sample code which illustrates how to > > 1. patch OS traps; or > > 2. patch a trap which uses a routine selector AETracker (written by C.K. Haun here at Ravenware) is a control panel that patches and monitors the AppleEvent manager, a selector-based trap. Why do I mention it? Because he's goofy enough to give away the source code, check out.... http://www.ravenware.com/sware/AET.src.3.0.1.sea.hqx for the source to the thing, which shows one way of patching a selector-based trap. Be warned that this was *not* written as sample code, so the style and (lack of) comments may be confusing. -- Alex Kinnison ALX@Ravenware.com Terrorist Technical Writing --------------------------- >From GUDATH@EZINFO.VMSMAIL.ETHZ.CH (Henrik 'Ratte' Gudat) Subject: Q: Appearance manager? Date: 9 Dec 1997 07:50:09 GMT Organization: F.E.Systems Emulation Technologies Hello, I'm trying to make some dialog boxes appearance manager savvy. I checked the latest Tools Chest CD but somehow Apple turned the Appearance stuff into the MacOS HI section. All technical information is gone - it only discusses GUI guidelines. Basically, I only need to know how to make a fancy group box/divider line in a modal dialog. Anyone willing to help? thanks a lot, henrik -- F.E.Systems Emulation Technologies http://www.magnet.ch/emutech/ +++++++++++++++++++++++++++ >From docnick@mailexcite.com (David Christie) Date: Wed, 10 Dec 1997 10:16:30 -0800 Organization: Pacific Bell Internet Services In article <66it7h$h6f$3@elna.ethz.ch>, GUDATH@EZINFO.VMSMAIL.ETHZ.CH (Henrik 'Ratte' Gudat) wrote: > Hello, > > I'm trying to make some dialog boxes appearance manager savvy. I checked the > latest Tools Chest CD but somehow Apple turned the Appearance stuff into the > MacOS HI section. All technical information is gone - it only discusses GUI > guidelines. Use this URL - http://gemma.apple.com/dev/techsupport/insidemac/MacOS8ToolboxRef/MacOS8Tool boxRefBook.pdf to get a pdf book describing all MacOS 8 subjects including the Appearance Manager. Basically, to make your dialog Appearance savvy, just add a dlgx resource with the appropriate data. The pdf should describe this resource and it's data. To make a separater line, you must use one of the new appearance controls. The control and it's proc id should also be discussed in the pdf. David Christie docnick@mailexcite.com +++++++++++++++++++++++++++ >From GUDATH@EZINFO.VMSMAIL.ETHZ.CH (Henrik 'Ratte' Gudat) Date: 10 Dec 1997 21:47:11 GMT Organization: F.E.Systems Emulation Technologies Thanks a lot to everyone who bothered helping me! - henrik --------------------------- >From DavidO@dascorp.com (David Phillip Oster) Subject: Q: How to tell if a volume is local or network? Date: Tue, 09 Dec 1997 18:14:05 -0800 Organization: Digital Arts & Sciences Corp. How does Find File know whether a volume is local or network? It is it enough to call PBGetVolMountInfo() to get info needed to mount the volume? Does one of the bits in PBHGetVolParms() give it away? Do you scan the volume control block array in low memory? Please tell me! -- -- Warning: posted from an unlocked cubicle: no guarantee its really me. WebTV means a whole new generation of even more clueless newbies. They are easy to filter out though. Just look for this header in their posts: Date: 00:00:00 +++++++++++++++++++++++++++ >From bradley@apple.com (Bob Bradley) Date: Tue, 09 Dec 1997 23:07:12 -0800 Organization: Uh huh huh...It says Organ In article , DavidO@dascorp.com (David Phillip Oster) wrote: > How does Find File know whether a volume is local or network? You can call PBHGetVolParmsSync and check if the vMServerAdr field of the GetVolParmsInfoBuffer is non-zero. There's a routine in MoreFiles named "HGetVolParms" and a macro named "isNetworkVolume" you can use to do this. +++++++++++++++++++++++++++ >From refiegle@snail.delcoelect.com Date: Wed, 10 Dec 97 12:54:11 PDT Organization: Delco Electronics Corp. In Article, writes: > How does Find File know whether a volume is local or network? There is a data member in one of parameter blocks called srvrAddress (maybe serverAddr). It's a long int. If this data member is 0, the volume is local. If it's not 0, it contains the "address" of the volume on the network. So, BOOLEAN is_network_volume = (yourParamBlockPtr->serverAddr != 0L) --------------------------- >From Jessica Wirna Subject: QuickTime in offscreen GWorlds... Date: Fri, 14 Nov 1997 15:11:12 -0700 Organization: AMUG Internet Services Does anyone know how to create an offscreen GWorld and render a quicktime animation into it? I have code that will create an offscreen GWorld, and code that will play a movie file from disk. Both of these run great on their own. Somehow, when I have them both in the same program, my Mac goes up in flames. I know that you need to tell the movie to play into the GWorld, so I can't figure what I am doing wrong. I suppose I am just looking for some code that will do the trick, although if anyone wants me to send my code (so they can have a look at it), I'd be more than happy to do that... Thanks, Jessica PS (please email me if you can, my netnews reader doesn't always work and I have missed some replies before...) +++++++++++++++++++++++++++ >From alex@witty.com (Alex Curylo) Date: Sat, 15 Nov 1997 09:01:05 -0800 Organization: Bavarian Illuminati In article , Jessica Wirna wrote: > Does anyone know how to create an offscreen GWorld and render a > quicktime animation into it? SetMovieGWorld(). > I suppose I am just > looking for some code that will do the trick, although if anyone wants me > to send my code (so they can have a look at it), I'd be more than happy to > do that... Well, if your GWorld is ok, and your movie is ok, that one call's all you need. I suppose I could look at it if this is really confusing you. - -- Alex Curylo -- alex@witty.com +++++++++++++++++++++++++++ >From j-jahnke@uchicago.edu (Jerome Jahnke) Date: Sun, 16 Nov 1997 00:49:18 GMT Organization: BSD/IS Center for Research Technologies -- U of Chicago In article , alex@witty.com (Alex Curylo) wrote: >In article , Jessica Wirna > wrote: > >> Does anyone know how to create an offscreen GWorld and render a >> quicktime animation into it? > >SetMovieGWorld(). > >> I suppose I am just >> looking for some code that will do the trick, although if anyone wants me >> to send my code (so they can have a look at it), I'd be more than happy to >> do that... > >Well, if your GWorld is ok, and your movie is ok, that one call's all you >need. I suppose I could look at it if this is really confusing you. I think you need to set the current port to the GWorld before you call SetMovieGWorld(). I remember having this problem with the video digitizers in the past. Jer, -- Jerome Jahnke Biological Sciences Division/ Office of Academic Computing University of Chicago +++++++++++++++++++++++++++ >From hawrelak@incentre.net (Alan Hawrelak) Date: 26 Nov 1997 00:31:55 GMT Organization: The Internet Centre In article , j-jahnke@uchicago.edu (Jerome Jahnke) wrote: > In article , alex@witty.com (Alex > Curylo) wrote: > > >In article , Jessica Wirna > > wrote: > > > >> Does anyone know how to create an offscreen GWorld and render a > >> quicktime animation into it? > > > >SetMovieGWorld(). > > > >> I suppose I am just > >> looking for some code that will do the trick, although if anyone wants me > >> to send my code (so they can have a look at it), I'd be more than happy to > >> do that... > > > >Well, if your GWorld is ok, and your movie is ok, that one call's all you > >need. I suppose I could look at it if this is really confusing you. > > I think you need to set the current port to the GWorld before you call > SetMovieGWorld(). I remember having this problem with the video digitizers > in the past. Your also have to be careful with which Quicktime calls you make, as some take a GrafPtr parameter but actually insist on a WindowPtr. If they are feed an offscreen GrafPtr, it will cause memory corruption when the call attempts to access the updateRgn field of what it thinks is a WindowRecord. (I learned this the hard way, of course.) Alan Hawrelak e-mail: hawrelak@incentre.net --------------------------- >From dmpalmer@clark.net (David Palmer) Subject: RAVE SDK? Date: Thu, 11 Dec 1997 22:00:31 -0500 Organization: Clark Internet Services, Inc. Does anyone know where I can get the RAVE SDK? The devworld RAVE SDK download page http://devworld.apple.com/dev/games/legal_q3dsdk_mac.html only lets me refuse to accept the license agreement; there is no opportunity to accept it and download. The www.unsupported.com web site has the DrawSprocket, but not the Rave SDK. If it is not available anywhere, could somebody mail me just the rave.h file? I want it to compile the free OreoAnimator package at http://www.realtime.net/~pangea/ -- David Palmer dmpalmer@clark.net http://www.clark.net/pub/dmpalmer/ +++++++++++++++++++++++++++ >From Keith Beasley Date: Fri, 12 Dec 1997 03:54:46 -0600 Organization: (none) Apple's Seeding and Development FTP sites had their passwords posted on pirate Hotline servers and consequently shut down. They're scrambling to get them back up. Keith Beasley keith@hiwaay.net +++++++++++++++++++++++++++ >From johnb@hk.super.net.remove_this_to_mail_me (John W. Blackburne) Date: Sat, 13 Dec 1997 00:16:03 +0800 Organization: Hong Kong Supernet In article , dmpalmer@clark.net (David Palmer) wrote: :The devworld RAVE SDK download page :http://devworld.apple.com/dev/games/legal_q3dsdk_mac.html :only lets me refuse to accept the license agreement; there :is no opportunity to accept it and download. Try: or The same folder (on either server as they're mirrors) contains the rest of the QD3D SDK, in case you need any other bits of it. John -- John Blackburne; programmer, writer, consultant, trainer tel/fax: Hong Kong (+852) 2816 7484 home page: --------------------------- >From d92-mbe@nadaNOSPAM.kth.se (Mikael Bergerholm) Subject: Saving into document resource fork Date: Tue, 09 Dec 1997 12:23:58 +0100 Organization: KTH Hi there I have a problem saving document data in the resource fork, i have finally got it to partially work, but only if i save the file in the same folder as the app. Not surprising since i use OpenResFile(), but if i use OpenRFPerm() i get a 'file not found'-error whatever folder i save to, the vRefNum of the file is -1, which i guess isn't handled the same way by OpenRFPerm() as by File manager functions. Anyway, does anyone know the correct way to do this, or a workaround? The following is the important lines of my saveroutine, much of the errorchecking removed: .. err=FSWrite(rnum,&length,buff); err=SetEOF(rnum,k); err=FSClose(rnum); err=FSpExchangeFiles(&fss,&sfr.sfFile); err=FSpDelete(&fss); //Datafork is saved without any problem here FSpCreateResFile(&sfr.sfFile,'GLOS','TEXT',smSystemScript); rrnum=OpenResFile(sfr.sfFile.name); //rrnum=OpenRFPerm(sfr.sfFile.name,sfr.sfFile.vRefNum,fsRdWrPerm); if(!ResError()) { .. //Prepares resource data AddResource(rh,'Fel ',4711,"\p"); CloseResFile(rrnum); .. //Cleans up handles etc. } err=GetVRefNum(rnum,&vref); err=FlushVol(nil,vref); .. thanks! /Mikael Bergerholm, d92-mbe@nada NOSPAM .kth.se +++++++++++++++++++++++++++ >From dstone@BIT.chem.utoronto.ca (David Stone) Date: 9 Dec 1997 15:27:49 GMT Organization: University of Toronto Chemistry In article , d92-mbe@nadaNOSPAM.kth.se (Mikael Bergerholm) wrote: [snip] > > FSpCreateResFile(&sfr.sfFile,'GLOS','TEXT',smSystemScript); > rrnum=OpenResFile(sfr.sfFile.name); Try using err=FSpOpenRF(&sfr,fsRdWrPerm,rrnum); since you have already created the file with FSSpec sfr (if I understand your abbreviated code correctly) and all you want to do is open the reousrce fork of an existing file. BTW, I think that it should be FSpCreateResFile(&sfr,..) not FSpCreateResFile(&sfr.sfFile,...), no? (The entry in TRef is a little confused) David Stone (remove the obvious bit to reply...) +++++++++++++++++++++++++++ >From DavidO@dascorp.com (David Phillip Oster) Date: Tue, 09 Dec 1997 10:04:29 -0700 Organization: Digital Arts & Sciences Corp. In article , dstone@BIT.chem.utoronto.ca (David Stone) wrote: >In article , >d92-mbe@nadaNOSPAM.kth.se (Mikael Bergerholm) wrote: >[snip] >> >> FSpCreateResFile(&sfr.sfFile,'GLOS','TEXT',smSystemScript); >> rrnum=OpenResFile(sfr.sfFile.name); > >Try using > > err=FSpOpenRF(&sfr,fsRdWrPerm,rrnum); That should be: FSpOpenResFile(). FSpOpenRF is used only for copying files. You can't write resources to a file opened that way. -- -- Warning: posted from an unlocked cubicle: no guarantee its really me. Give a man a fish: feed him for a day. Teach a man to fish: feed him for life. Teach a hundred men to fish: deplete the fish stock, destroy an ecosystem. +++++++++++++++++++++++++++ >From bradley@apple.com (Bob Bradley) Date: Tue, 09 Dec 1997 16:40:03 -0800 Organization: Uh huh huh...It says Organ In article , d92-mbe@nadaNOSPAM.kth.se (Mikael Bergerholm) wrote: > I have a problem saving document data in the resource fork, i have finally > got it to partially work, but only if i save the file in the same folder > as the app. Not surprising since i use OpenResFile(), but if i use > OpenRFPerm() i get a 'file not found'-error whatever folder i save to, > the vRefNum of the file is -1, which i guess isn't handled the same way by > OpenRFPerm() as by File manager functions. Use FSpOpenResFile instead of OpenResFile. --------------------------- >From western@westciv.com.au (John Allsopp) Subject: ShowDragHilite with non-white backgrounds Date: Mon, 10 Nov 1997 10:44:51 +1000 Organization: Western Civilisation Hi all, To blend in with the MacOS 8 look, many of the previously white backgounded windows in my app have become grey. This has caused a problem with drag and drop. While tracking drags, the windows call ShowDragHilite. The problem is that this currently only draws the hilite over the window's backgound that happens to be the same color as the current background color. This is particularly problemmatic as there is now no one backgound color, but possibly a number of them. How should the pen be set so that the drag hilite gets drawn correctly even over a number of colors? many thanks in advance, John Allsopp +++++++++++++++++++++++++++ >From slur@world.std.com (Scott Lahteine) Date: Mon, 10 Nov 1997 09:13:56 GMT Organization: Pylon Transit Authority In article , western@westciv.com.au (John Allsopp) wrote: >Hi all, > >To blend in with the MacOS 8 look, many of the previously white backgounded >windows in my app have become grey. This has caused a problem with drag and >drop. > >While tracking drags, the windows call ShowDragHilite. > >The problem is that this currently only draws the hilite over the window's >backgound that happens to be the same color as the current background >color. This is particularly problemmatic as there is now no one backgound >color, but possibly a number of them. > >How should the pen be set so that the drag hilite gets drawn correctly even >over a number of colors? For system routines your ForeColor should always be blackColor and the BackColor should be whiteColor. You should always reset these values after you drawing routines finish their thing. -- scott lahteine "being is faster than light" +++++++++++++++++++++++++++ >From western@westciv.com.au (John Allsopp) Date: Tue, 11 Nov 1997 12:02:30 +1000 Organization: Western Civilisation In article , slur@world.std.com (Scott Lahteine) wrote: > In article , > western@westciv.com.au (John Allsopp) wrote: > > >Hi all, > > > >To blend in with the MacOS 8 look, many of the previously white backgounded > >windows in my app have become grey. This has caused a problem with drag and > >drop. > > > >While tracking drags, the windows call ShowDragHilite. > > > >The problem is that this currently only draws the hilite over the window's > >backgound that happens to be the same color as the current background > >color. This is particularly problemmatic as there is now no one backgound > >color, but possibly a number of them. > > > >How should the pen be set so that the drag hilite gets drawn correctly even > >over a number of colors? > > For system routines your ForeColor should always be blackColor and the > BackColor should be whiteColor. You should always reset these values > after you drawing routines finish their thing. Scott, thanks for the prompt reply. Sadly, the result is not changed. At present, the best I can get is: by setting the back color (using RGBBackColor) to the color of the background, the drag hilite shows where the onscreen color is in fact that color. In olden times this was not an issue (the background was always white). Now I use the same interface look as list views in the finder in MacOS8, so the background of a window is not a uniform color (main column is darker than the others, while the separating lines are white.) Now, this must be doable as the finder does it :-/ I figure I might have to keep fiddling with transfer modes (which I never quite got hold of) :-) Thanks again (and any other pointers gladly accepted) John Allsopp +++++++++++++++++++++++++++ >From karlbunker@aol.com (KarlBunker) Date: 11 Nov 1997 14:43:43 GMT Organization: AOL http://www.aol.com In article , western@westciv.com.au (John Allsopp) wrote: >Hi all, > >To blend in with the MacOS 8 look, many of the previously white backgounded >windows in my app have become grey. This has caused a problem with drag and >drop. > >While tracking drags, the windows call ShowDragHilite. > >The problem is that this currently only draws the hilite over the window's >backgound that happens to be the same color as the current background >color. This is particularly problemmatic as there is now no one backgound >color, but possibly a number of them. > >How should the pen be set so that the drag hilite gets drawn correctly even >over a number of colors? I've just done it "manually". Get the user's hilite color, then draw and erase the hilite frame with your own routines. -- Karl Bunker KarlBunker@aol.com http://users.aol.com/karlbunker/ +++++++++++++++++++++++++++ >From docnick@mailexcite.com (David Christie) Date: Wed, 26 Nov 1997 13:39:04 -0800 Organization: Pacific Bell Internet Services In article , western@westciv.com.au (John Allsopp) wrote: > Hi all, > > To blend in with the MacOS 8 look, many of the previously white backgounded > windows in my app have become grey. This has caused a problem with drag and > drop. Funny, I was just about to post a question about this. ;) I believe I've solved half of this problem. Set the drag hilite color with SetThemePen using the kThemeDragHiliteBrush brush. Set the pen mode to 'blend', the pen size to 3,3, and FrameRect the drag rectangle. This seems to be how the finder does it. The problem is getting rid of the drag hilite. Of course you could manually redraw your window's contents over the hilite, but this is time consuming, expecially in my window which draws lots if icons. I'm really looking of an inverse operation for the blend mode, sort of like the invert mode which lets you draw something, and then erase it by drawing over it again. According to Inside Macintosh, the blend operation uses the formula - dest = source * weight / 65535 + destination * (1 - weight / 65535). It apparantly uses this formula on all fields of the RGB record (red, green, and blue). Dest is the new pixel color of the blended value. Source is the color you are applying to the window, which in this case is a constant - the drag hilite color. Weight is a constant value between 0 and 65535 which can be set with OpColor. Destination is the original pixel value before any drawing is done. Knowing this, it is possible to solve for destination and restore the original pixel color. Unfortunately, there doesn't seem to be any transfer mode to use that formula (that is, the blend formula solved for destination). Perhaps there is a way to install a custom color search or comp procedure in which you use the new formula manually. I havn't had much luck in this, but I've never had any luck with search and comp procedures. ;) Any help with this will be appreciated. --------------------------- >From derose@ira.uka.de (Cesar De Rose) Subject: Toolbox call for "Progress bar dialog" ? Date: 5 Dec 1997 07:14:12 GMT Organization: University of Karlsruhe (Germany) Is there a Toolbox call to display and manage a "Progress bar dialog" (those used by a copy operation) I looked in my inside Macisntosh books but they only had a reference to a funny translation progress dialog ... Regards, Cesar +++++++++++++++++++++++++++ >From i'm@not.here (Jeff Clites) Date: Fri, 05 Dec 1997 01:13:07 -0800 Organization: California Institute of Technology, Pasadena In article <6689k4$ftu$1@nz12.rz.uni-karlsruhe.de>, derose@ira.uka.de (Cesar De Rose) wrote: >Is there a Toolbox call to display and manage a "Progress bar >dialog" (those used by a copy operation) Yes, with the Appearance Manager (which is currently only for OS 8, though it is supposedly being made backward-compatible), no without it. It's not in IM yet--you can find the appearance manager docs on devworld, I believe at devworld.apple.com/macos8/, or something like that. There are progress bar CDEFs around--check Info-Mac (but you still have to put up and manage the dialog yourself, probably), or the Alt.Sources.Mac Archives at http://www.AmbrosiaSW.com/alt.sources.mac/ (if this URL doesn't work, try using "cafe." instead of "www.") - ------------------------------------------------------------------------ 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 WaterEdgSW@A-O-L.COM (Steve Makohin) Date: Sun, 07 Dec 1997 16:47:49 -0500 Organization: Water's Edge Software In article <6689k4$ftu$1@nz12.rz.uni-karlsruhe.de>, derose@ira.uka.de (Cesar De Rose) wrote: >Is there a Toolbox call to display and manage a "Progress bar >dialog" (those used by a copy operation) > >I looked in my inside Macisntosh books but they only had a reference >to a funny translation progress dialog ... MacOS 8's Appearance Manager has a control for it. In System 7, you just roll your own. An alternative is to get SuperCDEFs, a collection of 3D and flat buttons, tabs, sliders, and other controls which include a progress bar. The progress bar in SuperCDEFs is compatible with Aaron (a control panel that simulates the Platinum Appearance windows and controls). You can still roll your own with a few simple toolbox calls. -Steve Makohin | Remove dashes from email Water's Edge Software | address before replying. (Makers of Tools Plus and SuperCDEFs) | (Spam is getting bad) http://www.interlog.com/~wateredg | --------------------------- >From abz@videotron.ca (Alain Birtz) Subject: What Macsbug with system 8 Date: Sun, 30 Nov 1997 09:11:49 -0500 Organization: Cegep St-Hyacinthe College Macsbug 6.5.3 and 6.5.4a1 doesn't work with my 8500 and system 8: type 11 very soon at startup. What is the problem ? Is there any more recent version of Macsbug ? Thank you. Please, email a copy of your answer. -- Alain Birtz Cegep St-Hyacinthe College CompuServe [72467,2770] Internet abz@prisco.net +++++++++++++++++++++++++++ >From ross@nortel.ca (DSI) Date: Sun, 30 Nov 1997 15:01:52 -0500 Organization: Nortel Information Services / Desktop Technology & Management In article , abz@videotron.ca (Alain Birtz) wrote: >Macsbug 6.5.3 and 6.5.4a1 doesn't work with my 8500 and system 8: type 11 >very soon at startup. MacsBug 6.5.4a3c1 is still current, to my knowledge. It works fine with every beta version of Mac OS 8.1 we have received so far. You should be able to find it at . -- Ross Brown Desktop Systems Integration Nortel Information Services / Desktop Technology & Management +++++++++++++++++++++++++++ >From See_My_Sig@my.signature.block (Patrick L. Reilly) Date: Sun, 30 Nov 1997 16:19:56 -0700 Organization: SeeMySignatureBlock Alain Birtz wrote: > Macsbug 6.5.3 and 6.5.4a1 doesn't work with my 8500 and system 8: type 11 > very soon at startup. You need version 6.5.4a3c1 to run with Mac OS8. .... Patrick L. Reilly, Chief Gnome, Valpatken, Ltd. 1857 W. Calle del Norte Chandler, AZ 85224 V: +1.602.917.9543 (F: -9493) preilly@valpatken.com http://www.valpatken.com - ------------------------------------------------------ Home of The Organized Macintosh (TOM) --------------------------- >From dstone@BIT.chem.utoronto.ca (David Stone) Subject: When to close an open file? Date: 8 Dec 1997 15:12:28 GMT Organization: University of Toronto Chemistry A general question regarding files... What is the best general approach to dealing with files associated with specific, editable documents? Currently, I close the file once the data has been read, and re-open it to save any changes as needed. This means, however, that the file can be opened "behind my back". I could leave the file open until the user is done with the document, but this seems a bit risky in the event of any problems, especially when running up against the app's partition memory limit. Any other suggestions/strategies? David Stone (remove the obvious bit to reply...) +++++++++++++++++++++++++++ >From woody@alumni.caltech.edu (William Edward Woody) Date: Mon, 08 Dec 1997 12:43:09 -0800 Organization: In Phase Consulting dstone@BIT.chem.utoronto.ca (David Stone) wrote: > A general question regarding files... > > What is the best general approach to dealing with files associated > with specific, editable documents? Currently, I close the file > once the data has been read, and re-open it to save any changes as > needed. This means, however, that the file can be opened "behind > my back". I could leave the file open until the user is done with > the document, but this seems a bit risky in the event of any > problems, especially when running up against the app's partition > memory limit. Any other suggestions/strategies? Nope; those are the only two I've seen. Though you may want to put in a 'stack low memory' module to prevent your application from crashing in low memory situations. The way to do this (in general) is to first, allocate a block of memory. I usually allocate about 32K, though if you allocate memory using malloc() or operator new and don't check the return results, you may wish to allocate more like 128K. (Routines like malloc() allocate in 64K blocks.) Then, you set the SetGrowZone() procedure to a function which returns this allocated block when called. (And if you haven't already returned the block in a prior call.) When your grow zone proc is called, set a global flag. This flag should trigger a "memory is low" warning alert so the user knows you are starting to run out of memory. And in your event loop, try to reallocate the 128K block if it was given away. The upshot of this is that when your program calls any routines (including the OS routines NewHandle or NewPtr), or calls any routines which allocate memory (including system routines), instead of running flat out of memory (which could cause things like QuickDraw to crash), instead you should get a low memory warning. Then, if your application crashes later because your user didn't head the low memory warning, accidently keeping the file open because the user didn't quit or close windows like he was asked, it's not your problem. :-) - Bill -- William Edward Woody | In Phase Consulting woody@alumni.caltech.edu | Macintosh & Microsoft Windows http://www.alumni.caltech.edu/~woody | http://www.znd.net/inphase +++++++++++++++++++++++++++ >From erkyrath@netcom.com (Andrew Plotkin) Date: Mon, 8 Dec 1997 17:59:39 GMT Organization: Netcom On-Line Services David Stone (dstone@BIT.chem.utoronto.ca) wrote: > A general question regarding files... > What is the best general approach to dealing with files associated > with specific, editable documents? Currently, I close the file > once the data has been read, and re-open it to save any changes as > needed. This means, however, that the file can be opened "behind > my back". It can also be moved or renamed behind your back; your code to re-open the file should be aware of this. > I could leave the file open until the user is done with > the document, but this seems a bit risky in the event of any > problems, especially when running up against the app's partition > memory limit. Any other suggestions/strategies? The absolutely correct strategy, IMHO, is to close the file right away, and then remember its last-changed datestamp *and* create an alias for it (not just an FSSpec.) Then, when you want to save more changes, you follow the alias (in case the file has moved or changed name), check the last-changed stamp (and possibly put up a dialog saying "The file has been changed. Do you wish to overwrite those changes, throw away your own changes, or save as a different file?") This is, of course, a tremendous pain and I don't do it that way myself. I believe you can safely leave a file open if you call both PBFlushFile() and FlushVol() -- that is, even if your machine crashes, the file will be properly updated, as if you'd closed it. But I'm not certain of that. --Z -- "And Aholibamah bare Jeush, and Jaalam, and Korah: these were the borogoves..." +++++++++++++++++++++++++++ >From dstone@BIT.chem.utoronto.ca (David Stone) Date: 9 Dec 1997 15:05:16 GMT Organization: University of Toronto Chemistry In article , woody@alumni.caltech.edu (William Edward Woody) wrote: > [snip] > > Though you may want to put in a 'stack low memory' module to > prevent your application from crashing in low memory situations. > [snip] > > When your grow zone proc is called, set a global flag. This > flag should trigger a "memory is low" warning alert so the > user knows you are starting to run out of memory. Thanks for the suggestion, Bill. I do have a grow zone block/memory reserve implemented, but I hadn't thought to put in an alert flag. I'll add that in, then use the "leave file open/call FlushVol" route to keep the file locked while the document is open. David Stone (remove the obvious bit to reply...) +++++++++++++++++++++++++++ >From Mark Weinstein Date: Mon, 08 Dec 1997 15:32:01 +0000 Organization: None > >A general question regarding files... > >What is the best general approach to dealing with files associated >with specific, editable documents? Currently, I close the file >once the data has been read, and re-open it to save any changes as >needed. This means, however, that the file can be opened "behind >my back". In fact, once you close that file, the user can do a lot of nasty things "behind [your] back." If the document is located on a volume other than the startup volume (such as a floppy disk), the user can unmount/eject the volume containing the file. In addition, the user can delete the document, change the name or location of the document such that you will not be able to locate it when you try to re-open it, or as you mentioned, open the document in another program and do all kinds of damage. Your application must be able to handle all of these possibilities gracefully. However, all of these problems are eliminated if you simply open the file, read from it, and leave the file handle open until you need to write to it. Many applications do this. (Most of these programs, in fact, must do it this way; they deal with huge documents which cannot be loaded into memory at one time, such as databases, etc..).. >I could leave the file open until the user is done with >the document, but this seems a bit risky in the event of any >problems, especially when running up against the app's partition >memory limit. Any other suggestions/strategies? I do not see why leaving the file open while it is being edited will significantly increase the memory your application will consume. Moreover, your memory "risks" are much greater when you try to re-open the file at save-time. You run the risk that the data structures the MacOS needs to allocate will not be available when you try to save. If you open the file when you first read it - and just leave that file open - such a risk is eliminated. In terms of general principles, I do not think there is anything wrong with leaving the file handle open while the file is being edited. Whenever you write something to the file, make sure you call PBFlushFile() with the file's reference number and PBFlushVol() with the volume's reference number. In addition, if your application writes the entire file out at one time, I recommend that you use PBExchangeFiles() to do a "safe-save" of a file. You can open/create a new temporary file, write the data to it, and then use PBExchangeFiles() to swap the data of the temporary file with the file you wish to save. Later. markwein@iname.com +++++++++++++++++++++++++++ >From Paul Bruneau Date: Fri, 12 Dec 1997 08:34:32 -0500 Organization: Special-Lite, Inc. Mark Weinstein wrote: > > > > >A general question regarding files... > > > >What is the best general approach to dealing with files associated > >with specific, editable documents? Currently, I close the file > >once the data has been read, and re-open it to save any changes as > >needed. This means, however, that the file can be opened "behind > >my back". > > In fact, once you close that file, the user can do a lot of nasty things > "behind [your] back." If the document is located on a volume other than > the startup volume (such as a floppy disk), the user can unmount/eject > the volume containing the file. In addition, the user can delete the > document, change the name or location of the document such that you will > not be able to locate it when you try to re-open it, or as you > mentioned, open the document in another program and do all kinds of > damage. Your application must be able to handle all of these > possibilities gracefully. > Another reason: In a multiuser scenario, leaving it open should prevent other people from being able to open the same file while the first user is modifying it. This will prevent lots of nasty version error problems! PB --------------------------- >From Mark Weinstein Subject: [Q] Low level disk access on large drives Date: Thu, 27 Nov 1997 12:45:16 +0000 Organization: None I am writing a utility for the Macintosh that requires low-level access to the sectors on a volume. For the past several years, I have been using PBRead() and PBWrite() calls to the device driver. This has worked fine. The code is pretty simple- it sets the drive number, driver reference number, ioPosMode, and ioPosOffset to the offset (in bytes) where I want to read or write. However, since ioPosOffset is only a 32-bit value, PBRead() and PBWrite() cannot be used in this fashion to read beyond the four gigabytes. Does anyone know how to perform a low-level read or write to a drive greater than four gigabytes? Any help appreciated. m_weinstein@msn.com +++++++++++++++++++++++++++ >From bhahn@spam-spam.go-away.com (Brendan Hahn) Date: Mon, 01 Dec 1997 11:00:56 -0800 Organization: Transoft Corp m_weinstein@msn.com wrote: >However, since ioPosOffset is only a 32-bit value, PBRead() and >PBWrite() cannot be used in this fashion to read beyond the four >gigabytes. > >Does anyone know how to perform a low-level read or write to a drive >greater than four gigabytes? Make sure you have up-to-date system interfaces and check out the XIOParam structure in Files.{a,h,p}. If you are talking directly to drivers, you'd need to know if they support 64-bit offsets. There must be a way for drivers to indicate this, but I don't know offhand what it is--you might look at the Driver Gestalt section of "Designing PCI Cards and Drivers." In theory, you could get 64-bit addressing by advancing the "current position" of the file or driver with a series of reads using the fsFromMark mode and 32-bit offsets and then use fsAtMark for your IO. I have a feeling it wouldn't work unles 64-bit offsets were already directly supported, though. bhahn@transoft.mangle.net <-- unmangle to reply +++++++++++++++++++++++++++ >From bhahn@spam-spam.go-away.com (Brendan Hahn) Date: Mon, 01 Dec 1997 11:07:26 -0800 Organization: Transoft Corp I wrote: >If you are talking directly to drivers, you'd need to know if they support >64-bit offsets. There must be a way for drivers to indicate this, but I >don't know offhand what it is--you might look at the Driver Gestalt section >of "Designing PCI Cards and Drivers." Come to think of it, this is presumably implicit in the drive information from the DQE or a GetDriveStatus call--if the drive is over 4G, the driver handles 64-bit offsets, and if not it doesn't matter. bhahn@transoft.mangle.net <-- unmangle to reply --------------------------- >From Peter Amberg Subject: [Q] Page Flipping Date: Fri, 12 Dec 1997 10:06:14 +0100 Organization: Swiss Federal Institute of Technology (ETHZ) I'm very excited I have found a code snippet that should flip the video page if the video card supports that: http://www.best.com/~mxmora/c.s.m.g.p.b.8.html However, on my old Mac IIvx it does not work at all (probably because the video card doesn't support multiple pages), and it hangs on the PowerMac of a friend of mine. [Q] Has anyone experience with page-flipping on the Mac? Is there source code available that works? [Q] Will Apple's future video cards support multiple pages? Any news is greatly appreciated! /Peter +++++++++++++++++++++++++++ >From johnb@hk.super.net.remove_this_to_mail_me (John W. Blackburne) Date: Sat, 13 Dec 1997 00:42:24 +0800 Organization: Hong Kong Supernet In article <3490FE86.3F2B@iiic.ethz.ch>, Peter Amberg wrote: :I'm very excited I have found a code snippet that should flip the video :page if the video card supports that: : :http://www.best.com/~mxmora/c.s.m.g.p.b.8.html : :However, on my old Mac IIvx it does not work at all (probably because :the video card doesn't support multiple pages), and it hangs on the :PowerMac of a friend of mine. I think the only 68k Mac line that supported page flipping was the Quadra/Performa 630/640. Some 68k/NuBus video cards also may have supported it but I'm not sure which. More PowerMacs and many PCI video cards support page flipping, including PowerMac/Performa 6xxx models and 7xxx/8xxx PCI PowerMacs with 4MB of VRAM. But the lack of documentation and the lack of a consistent interface for programming it meant it was very difficult ot use, and few programs did - Marathon is the only one that I know of. :[Q] Has anyone experience with page-flipping on the Mac? Is there source :code available that works? Apple released DrawSprocket to provide a programming interface for games that need such capabilties: it basically provides routines for page flipping which work on all Macs, calling hardware when available and falling back on optimised blitting when not. Unfortunately it's PPC only. You could just do page flipping on PPC Macs - with so few 68k Macs supporting it you're looking at a small fraction of the 68k Market, and 68k users are only a small fraction of sales for many Mac games today. Or use DrawSprocket for PPC and the code you have for 68k, though I'd at least verify it works on at least one 68k Mac, and doesn't crash on others. :[Q] Will Apple's future video cards support multiple pages? Very probably: The Rage II chips in the G3 Macs and 6500, the onboard video of 7xxx/8xxx PCI Macs and (I think) the video cards in the high end Macs all support page flipping, though the 7xxx/8xxx models need to have 4MB VRAM installed, and others are severely limited with only 2MB. About the only Macs shipping today that don't support it are the PowerBooks. John -- John Blackburne; programmer, writer, consultant, trainer tel/fax: Hong Kong (+852) 2816 7484 home page: +++++++++++++++++++++++++++ >From *johnnyc*@or.psychology.dal.ca (John Christie) Date: Fri, 12 Dec 1997 13:35:48 -0400 Organization: ISINet, Nova Scotia In article , johnb@hk.super.net.remove_this_to_mail_me (John W. Blackburne) wrote: > I think the only 68k Mac line that supported page flipping was the > Quadra/Performa 630/640. Some 68k/NuBus video cards also may have > supported it but I'm not sure which. More PowerMacs and many PCI video > cards support page flipping, including PowerMac/Performa 6xxx models and > 7xxx/8xxx PCI PowerMacs with 4MB of VRAM. > The first Macs to support page flipping were the toasters. In addition, the II video card was the first in color (when set to 4 bits). Since then, things went steadily down hill :). -- You aren't free if you CAN choose - only if you DO choose. All you are is the decisions you make. Remove "*" and ohnny (i.e. jc@) to reply via email --------------------------- >From trickys@earthlink.net (Stefan Sinclair) Subject: _vAdjEOF - why am I dying here? Date: 10 Dec 1997 05:59:57 GMT Organization: EarthLink Network, Inc. Hello... lately I have been running into a very troublesome problem while working on a large project. The problem is that ever since I upgraded my development machine to OS8, my program keeps bombing in a specific location, inside something called "_vAdjEOF" according to MacsBug (when debugging in CW, CW doesn't catch the bug so I get dumped into MacsBug). I'm guessing by the name of it that this has something to do with file handling. The place where my program dies is in a spot right after I close a sound file that I had been playing asynchronously from. However, I check for errors after all my file handling calls & everything seems to be fine. Does anybody know anything about "_vAdjEOF" or why I would be bombing here so often after upgrading to OS8? This has become one of those bugs that is impossible to track down (at least at my skill level, anyway :-) Anybody who could shed some light on this matter would make me a very happy person :-) Thank you, -Stefan email: trickys@doomhammer.com +++++++++++++++++++++++++++ >From rang@trillium.adaptec.com (Anton Rang) Date: Fri, 12 Dec 1997 13:50:26 -0600 Organization: Adaptec Trillium Development Center In article , trickys@doomhammer.com wrote: > Hello... > lately I have been running into a very troublesome problem while > working on a large project. The problem is that ever since I > upgraded my development machine to OS8, my program keeps bombing > in a specific location, inside something called "_vAdjEOF" > according to MacsBug (when debugging in CW, CW doesn't catch the > bug so I get dumped into MacsBug). I'm guessing by the name of it > that this has something to do with file handling. The place where > my program dies is in a spot right after I close a sound file > that I had been playing asynchronously from. However, I check > for errors after all my file handling calls & everything seems to > be fine. _vAdjEOF is sort of a generic symbol for the file manager (something like the last published symbol in a big range of it). Here's a few things I'd check; there are probably other possibilities. 1. Open and Close don't work at interrupt time, are you doing them at task level? Are you trying to call them asynchronously? (That doesn't work either, even at task level.) 2. Are you sure that all of your asynchronous read or write calls have completed by the time the file is closed? 3. Are you sure you're closing the right file? (Use 'file' in MacsBug.) Hope this helps, -- Anton +++++++++++++++++++++++++++ >From trickys@earthlink.net (Stefan Sinclair) Date: 13 Dec 1997 05:02:14 GMT Organization: EarthLink Network, Inc. Hi! thanks for your reply. I've been scouring my code and haven't been able to find the problem. Just in case you know something I don't, here's a quick rundown of what I'm doing that causes this behavior... This is happening right after I close an AIFF file from which I have been playing sound asynchronously. The crash will never occur when I step through the code in the CW debugger. However, if I run through it in the CW debugger, it stops w/ a bus error but does not show where in the code it happens (I know that it is right after closing the AIFF file though based on what hasn't happened yet in the app). If I run outside the CW debugger, I get dumped into Macsbug at _vAdjEOF. The crashing occurs about 75% of the time, and always in the same place, but only after I upgraded to OS8. Is it my code, or a bug in OS8 maybe? I dunno... Here's how I open the AIFF file... short GetBGMusicFile(Str255 fileName) { short newDataFile=0; OSErr err=noErr; err = FSOpen(fileName, 0, &newDataFile); if(err != noErr) DoError(kCouldNotOpenBGMusicFile, true); return newDataFile; // File is left open! } .. then I play from it by making repeated calls to this function in my main loop... // LoopSoundFromFile void TSpriteGame::LoopSoundFromFile(void) { if(!SndChannelBusy(this->sndChanP) && this->soundFileRefNum != 0) { if(SndStartFilePlay(this->sndChanP, this->soundFileRefNum, 0, 20480, nil, nil, nil, true) != noErr) this->DoError(kSoundFilePlayError, true); } } .. when I'm done I close the AIFF file like this: // Turn off music & close the file err = SndStopFilePlay(this->sndChanP, true); if(err != noErr) DoError(kCouldNotStopSoundFilePlayChannel, true); // File I/O should be done now, right??? err = FSClose(this->soundFileRefNum); if(err != noErr || SndChannelBusy(this->sndChanP)) DoError(kUnclassifiedErrorCode, true); The crash will occur at this time. I can't see what I'm doing wrong; no errors are ever reported, and my soundChannel is fine. Do you see something obvious I'm doing wrong? This happens w/ different AIFF files, so it's not a bad input file I don't think. I've repeated the crash on a few different PowerMacs running OS8 now. Earlier versions of MacOS run the code just fine. Anyway, thanks for your help! -Stefan On Fri, 12 Dec 1997 13:50:26 -0600, Anton Rang wrote: >In article , >trickys@doomhammer.com wrote: >> Hello... >> lately I have been running into a very troublesome problem while >> working on a large project. The problem is that ever since I >> upgraded my development machine to OS8, my program keeps bombing >> in a specific location, inside something called "_vAdjEOF" >> according to MacsBug (when debugging in CW, CW doesn't catch the >> bug so I get dumped into MacsBug). I'm guessing by the name of it >> that this has something to do with file handling. The place where >> my program dies is in a spot right after I close a sound file >> that I had been playing asynchronously from. However, I check >> for errors after all my file handling calls & everything seems to >> be fine. > > _vAdjEOF is sort of a generic symbol for the file manager (something >like the last published symbol in a big range of it). > > Here's a few things I'd check; there are probably other possibilities. > > 1. Open and Close don't work at interrupt time, are you doing them at task > level? Are you trying to call them asynchronously? (That doesn't work > either, even at task level.) > > 2. Are you sure that all of your asynchronous read or write calls have > completed by the time the file is closed? > > 3. Are you sure you're closing the right file? (Use 'file' in MacsBug.) > > Hope this helps, > > -- Anton +++++++++++++++++++++++++++ >From "Rodney K. Magnuson" Date: Thu, 11 Dec 1997 16:48:59 -0700 Organization: HellRaisers, INC. Stefan, I have seen this as well. At one point it became so bad I did a reinstall of OS8. This seemed to work for awhile, but I still ocassionally see it. I typically have novel servers mounted via AppleShare when this occurs. Ring any bells? Rod Stefan Sinclair wrote: > > Hello... > lately I have been running into a very troublesome problem while > working on a large project. The problem is that ever since I > upgraded my development machine to OS8, my program keeps bombing > in a specific location, inside something called "_vAdjEOF" > according to MacsBug (when debugging in CW, CW doesn't catch the > bug so I get dumped into MacsBug). I'm guessing by the name of it > that this has something to do with file handling. The place where > my program dies is in a spot right after I close a sound file > that I had been playing asynchronously from. However, I check > for errors after all my file handling calls & everything seems to > be fine. > Does anybody know anything about "_vAdjEOF" or why I would be > bombing here so often after upgrading to OS8? This has become > one of those bugs that is impossible to track down (at least > at my skill level, anyway :-) Anybody who could shed some light > on this matter would make me a very happy person :-) > > Thank you, > > -Stefan > > email: trickys@doomhammer.com +++++++++++++++++++++++++++ >From trickys@earthlink.net (Stefan Sinclair) Date: 14 Dec 1997 16:44:00 GMT Organization: EarthLink Network, Inc. I am having this problem whether or not it's on a networked machine. Here's some more details on the actual code I'm using: This is happening right after I close an AIFF file from which I have been playing sound asynchronously. The crash will never occur when I step through the code in the CW debugger. However, if I run through it in the CW debugger, it stops w/ a bus error but does not show where in the code it happens (I know that it is right after closing the AIFF file though based on what hasn't happened yet in the app). If I run outside the CW debugger, I get dumped into Macsbug at _vAdjEOF. The crashing occurs about 75% of the time, and always in the same place, but only after I upgraded to OS8. Is it my code, or a bug in OS8 maybe? I dunno... Here's how I open the AIFF file... short GetBGMusicFile(Str255 fileName) { short newDataFile=0; OSErr err=noErr; err = FSOpen(fileName, 0, &newDataFile); if(err != noErr) DoError(kCouldNotOpenBGMusicFile, true); return newDataFile; // File is left open! } .. then I play from it by making repeated calls to this function in my main loop... // LoopSoundFromFile void TSpriteGame::LoopSoundFromFile(void) { if(!SndChannelBusy(this->sndChanP) && this->soundFileRefNum != 0) { if(SndStartFilePlay(this->sndChanP, this->soundFileRefNum, 0, 20480, nil, nil, nil, true) != noErr) this->DoError(kSoundFilePlayError, true); } } .. when I'm done I close the AIFF file like this: // Turn off music & close the file err = SndStopFilePlay(this->sndChanP, true); if(err != noErr) DoError(kCouldNotStopSoundFilePlayChannel, true); // File I/O should be done now, right??? err = FSClose(this->soundFileRefNum); if(err != noErr || SndChannelBusy(this->sndChanP)) DoError(kUnclassifiedErrorCode, true); The crash will occur at this time. I can't see what I'm doing wrong; no errors are ever reported, and my soundChannel is fine. Do you see something obvious I'm doing wrong? This happens w/ different AIFF files, so it's not a bad input file I don't think. I've repeated the crash on a few different PowerMacs running OS8 now. Earlier versions of MacOS run the code just fine. Anyway, thanks for your help! -Stefan On Thu, 11 Dec 1997 16:48:59 -0700, Rodney K. Magnuson wrote: >Stefan, > >I have seen this as well. At one point it became so bad I did a >reinstall of OS8. This seemed to work for awhile, but I still >ocassionally see it. > >I typically have novel servers mounted via AppleShare when this occurs. >Ring any bells? > >Rod > >Stefan Sinclair wrote: >> >> Hello... >> lately I have been running into a very troublesome problem while >> working on a large project. The problem is that ever since I >> upgraded my development machine to OS8, my program keeps bombing >> in a specific location, inside something called "_vAdjEOF" >> according to MacsBug (when debugging in CW, CW doesn't catch the >> bug so I get dumped into MacsBug). I'm guessing by the name of it >> that this has something to do with file handling. The place where >> my program dies is in a spot right after I close a sound file >> that I had been playing asynchronously from. However, I check >> for errors after all my file handling calls & everything seems to >> be fine. >> Does anybody know anything about "_vAdjEOF" or why I would be >> bombing here so often after upgrading to OS8? This has become >> one of those bugs that is impossible to track down (at least >> at my skill level, anyway :-) Anybody who could shed some light >> on this matter would make me a very happy person :-) >> >> Thank you, >> >> -Stefan >> >> email: trickys@doomhammer.com +++++++++++++++++++++++++++ >From "Hank van Tunen" Date: Mon, 15 Dec 1997 06:49:10 GMT Organization: (none) Hi Stefan, Your code that checks for the file being open in "TSpriteGame::LoopSoundFromFile" is testing "this->soundFileRefNum" which is correct, however, the FSClose call will obviously not zero this for you. You must add "this->soundFileRefNum = 0" after the call to FSClose. Hope this helps. Hank van Tunen hankvt at chancery dot com Stefan Sinclair wrote in article ... > I am having this problem whether or not it's on a networked machine. > Here's some more details on the actual code I'm using: > This is happening right after I close an AIFF file > from which I have been playing sound asynchronously. > The crash will never occur when I step through the > code in the CW debugger. However, if I run through it > in the CW debugger, it stops w/ a bus error but does > not show where in the code it happens (I know that it is > right after closing the AIFF file though based on what > hasn't happened yet in the app). If I run outside the CW > debugger, I get dumped into Macsbug at _vAdjEOF. > The crashing occurs about 75% of the time, and always in > the same place, but only after I upgraded to OS8. Is it > my code, or a bug in OS8 maybe? I dunno... > > Here's how I open the AIFF file... > > short GetBGMusicFile(Str255 fileName) > { > short newDataFile=0; > OSErr err=noErr; > > err = FSOpen(fileName, 0, &newDataFile); > if(err != noErr) > DoError(kCouldNotOpenBGMusicFile, true); > > return newDataFile; > > // File is left open! > } > > .. then I play from it by making repeated calls to > this function in my main loop... > > // LoopSoundFromFile > void TSpriteGame::LoopSoundFromFile(void) > { > if(!SndChannelBusy(this->sndChanP) && this->soundFileRefNum != 0) > { > if(SndStartFilePlay(this->sndChanP, this->soundFileRefNum, > 0, 20480, nil, nil, nil, true) != noErr) > this->DoError(kSoundFilePlayError, true); > } > } > > .. when I'm done I close the AIFF file like this: > > // Turn off music & close the file > err = SndStopFilePlay(this->sndChanP, true); > if(err != noErr) > DoError(kCouldNotStopSoundFilePlayChannel, true); > // File I/O should be done now, right??? > err = FSClose(this->soundFileRefNum); > if(err != noErr || SndChannelBusy(this->sndChanP)) > DoError(kUnclassifiedErrorCode, true); > > The crash will occur at this time. I can't see what I'm doing > wrong; no errors are ever reported, and my soundChannel is > fine. Do you see something obvious I'm doing wrong? > This happens w/ different AIFF files, so it's not a bad > input file I don't think. I've repeated the crash on a few > different PowerMacs running OS8 now. Earlier versions of > MacOS run the code just fine. > > Anyway, thanks for your help! > > -Stefan +++++++++++++++++++++++++++ >From Stefan Date: Tue, 16 Dec 1997 23:35:08 -0600 Organization: His own bad self. Thanks for the feedback. I don't think in my case I should need to worry about setting this->soundFileRefNum = 0 since I never attempt to access the file after closing it anyway; otherwise, I certainly would do that. Anyway, FYI I seem to have been able to circumvent the crashing behavior by adding a seemingly unnecessary bit of code. Immediately after calling FSClose() on the AIFF file, I then do this: int loop = 0 while(!SndChannelBusy(this->sndChanP) && loop < 100) loop++; which exits after the first check (and of course it should!), but it seems that this otherwise pointless prodding of the sound channel one time is all that is required to avoid the crashing. I have not had the problem since adding that little extra bit of code. The "loop" variable is just a safegaurd against executing an infinite loop. Anybody from Apple lurking here who might be able to shed some light on this weirdness? -Stefan Hank van Tunen wrote: > > Hi Stefan, > > Your code that checks for the file being open in > "TSpriteGame::LoopSoundFromFile" is testing > "this->soundFileRefNum" which is correct, however, the FSClose call will > obviously not zero this for you. > You must add "this->soundFileRefNum = 0" after the call to FSClose. > > Hope this helps. > > Hank van Tunen > hankvt at chancery dot com > > Stefan Sinclair wrote in article > ... > > I am having this problem whether or not it's on a networked machine. > > Here's some more details on the actual code I'm using: > > This is happening right after I close an AIFF file > > from which I have been playing sound asynchronously. > > The crash will never occur when I step through the > > code in the CW debugger. However, if I run through it > > in the CW debugger, it stops w/ a bus error but does > > not show where in the code it happens (I know that it is > > right after closing the AIFF file though based on what > > hasn't happened yet in the app). If I run outside the CW > > debugger, I get dumped into Macsbug at _vAdjEOF. > > The crashing occurs about 75% of the time, and always in > > the same place, but only after I upgraded to OS8. Is it > > my code, or a bug in OS8 maybe? I dunno... > > > > Here's how I open the AIFF file... > > > > short GetBGMusicFile(Str255 fileName) > > { > > short newDataFile=0; > > OSErr err=noErr; > > > > err = FSOpen(fileName, 0, &newDataFile); > > if(err != noErr) > > DoError(kCouldNotOpenBGMusicFile, true); > > > > return newDataFile; > > > > // File is left open! > > } > > > > .. then I play from it by making repeated calls to > > this function in my main loop... > > > > // LoopSoundFromFile > > void TSpriteGame::LoopSoundFromFile(void) > > { > > if(!SndChannelBusy(this->sndChanP) && this->soundFileRefNum != 0) > > { > > if(SndStartFilePlay(this->sndChanP, > this->soundFileRefNum, > > 0, 20480, nil, nil, nil, true) != noErr) > > this->DoError(kSoundFilePlayError, true); > > } > > } > > > > .. when I'm done I close the AIFF file like this: > > > > // Turn off music & close the file > > err = SndStopFilePlay(this->sndChanP, true); > > if(err != noErr) > > DoError(kCouldNotStopSoundFilePlayChannel, true); > > // File I/O should be done now, right??? > > err = FSClose(this->soundFileRefNum); > > if(err != noErr || SndChannelBusy(this->sndChanP)) > > DoError(kUnclassifiedErrorCode, true); > > > > The crash will occur at this time. I can't see what I'm doing > > wrong; no errors are ever reported, and my soundChannel is > > fine. Do you see something obvious I'm doing wrong? > > This happens w/ different AIFF files, so it's not a bad > > input file I don't think. I've repeated the crash on a few > > different PowerMacs running OS8 now. Earlier versions of > > MacOS run the code just fine. > > > > Anyway, thanks for your help! > > > > -Stefan -- ______________ |\ \ | \ ____________\ | | _________ | Stefan Sinclair | | /@--------\ | Please send replies to: | | | | | trickys@doomhammer.com | | | | | http://www.doomhammer.com | | \_________/ | | | ____ | | | o Mac | A)bort, R)etry, G)et a Mac? \ |_____________| \|____________| +++++++++++++++++++++++++++ >From Stefan Date: Tue, 16 Dec 1997 23:51:13 -0600 Organization: His own bad self. [snip] This should have read "Immediately BEFORE calling FSClose()" (it DOES make a difference, in case anyone cares :-) It's already been a long week, & it's only Tuesday. -Stefan > > Anyway, FYI I seem to have been able to circumvent the > crashing behavior by adding a seemingly unnecessary > bit of code. Immediately after calling FSClose() on > the AIFF file, I then do this: > int loop = 0 > while(!SndChannelBusy(this->sndChanP) && loop < 100) > loop++; > > which exits after the first check (and of course it > should!), but it seems that this otherwise pointless > prodding of the sound channel one time is all that > is required to avoid the crashing. I have not had the > problem since adding that little extra bit of code. > The "loop" variable is just a safegaurd against executing > an infinite loop. > > Anybody from Apple lurking here who might be able to > shed some light on this weirdness? > > -Stefan [snip] --------------------------- >From ilesasw@aol.com (Ilesa SW) Subject: launching an application? Date: 6 Dec 1997 03:21:17 GMT Organization: AOL http://www.aol.com Does anyone have any sample code to launch an application (or bring it to the fron if its already open), given the application's creator code? Any help is appreciated! Mal. Email responses to mal@ilesa.com +++++++++++++++++++++++++++ >From uzs90z@ibm.rhrz.uni-bonn.de (Michael Schuerig) Date: Sat, 6 Dec 1997 12:47:25 +0100 Organization: Completely Disorganized Ilesa SW wrote: > Does anyone have any sample code to launch an application (or bring it to the > fron if its already open), given the application's creator code? Look on Apple's dev site for SignatureToApp (it's on Dev CDs, too). Michael -- Michael Schuerig Consistency is the last refuge mailto:uzs90z@uni-bonn.de of the unimaginative. http://www.uni-bonn.de/~uzs90z/ -Oscar Wilde +++++++++++++++++++++++++++ >From see.the.bottom@of.my.post (Brent A. Carey) Date: 7 Dec 1997 11:16:00 -0700 Organization: Software For Humans, Inc. In article <19971206032100.WAA28502@ladder01.news.aol.com>, ilesasw@aol.com (Ilesa SW) wrote: > Does anyone have any sample code to launch an application (or bring it to the > fron if its already open), given the application's creator code? > > Any help is appreciated! > Mal. Email responses to mal@ilesa.com Here is some code that will launch an application under System 7.x or greater. I derived this code from some sample code in Think Reference that launches an app referred to by a StandardFileReply. I added the code that uses PBDTGetAPPL() and FSMakeFSSpec() to locate the file by its signature. This code isn't tested, so it may not be error-free, but it's pretty close and will give you the idea anyway. - ------------------------------------------------------------ #include void LaunchAppBySignature (OSType theSignature) { DTPBPtr myParamBlock; LaunchParamBlockRec myLaunchParams; ProcessSerialNumber launchedProcessSN; FSSpec theApp; OSErr launchErr; long prefSize; long minSize; long availSize; myParamBlock->ioIndex = 0; // returns the most recent version myParamBlock->ioFileCreator = theSignature; PBDTGetAPPL(myParamBlock, 0); FSMakeFSSpec(ioVRefNum, myParamBlock->ioAPPLParID, myParamBlock->ioNamePtr, &theApp); myLaunchParams.launchBlockID = extendedBlock; myLaunchParams.launchEPBLength = extendedBlockLen; myLaunchParams.launchFileFlags = 0; myLaunchParams.launchControlFlags = launchContinue + launchNoFileFlags; myLaunchParams.launchAppSpec = &theApp; myLaunchParams.launchAppParameters = nil; launchErr = LaunchApplication(&myLaunchParams); prefSize = myLaunchParams.launchPreferredSize; minSize = myLaunchParams.launchMinimumSize; if (!launchErr) { launchedProcessSN = myLaunchParams.launchProcessSN; } else if (launchErr == memFullErr) { availSize = myLaunchParams.launchAvailableSize; } else { // handle launchErr } } - ------------------------------------------------------------ -- Brent A. Carey Software For Humans, Inc. - --------------------------------------------------------------- The e-mail address in the header was falsified to deter spamming. You may contact me at: brent@softwareforhumans.com --------------------------- >From derose@ira.uka.de (Cesar De Rose) Subject: read clock for less than one second ? Date: 12 Dec 1997 11:48:07 GMT Organization: University of Karlsruhe (Germany) Hi, I want to read the system clock to wait some time (for visualisation puproposes) but I not able to find a routine that returns a time unit smaller than one second :( Any hints ... Thanks in advance, Cesar +++++++++++++++++++++++++++ >From Peter Amberg Date: Fri, 12 Dec 1997 16:21:18 +0100 Organization: Swiss Federal Institute of Technology (ETHZ) Cesar De Rose wrote: > > Hi, > > I want to read the system clock to wait > some time (for visualisation puproposes) but I not > able to find a routine that returns a time unit > smaller than one second :( You can easily wait for system ticks (1/60 seconds). Try: long L; L = TickCount(); while (TickCount() - L < ticksToWait); Or: long L; Delay (ticksToWait, &L); If you want to wait for a time shorter than 1/60 second, I think there's no easy way. You'll have to set up a Time Manager interrupt, I guess. /Peter +++++++++++++++++++++++++++ >From rang@trillium.adaptec.com (Anton Rang) Date: Fri, 12 Dec 1997 13:52:29 -0600 Organization: Adaptec Trillium Development Center In article <66r89n$qc1$1@nz12.rz.uni-karlsruhe.de>, derose@ira.uka.de (Cesar De Rose) wrote: > Hi, > > I want to read the system clock to wait > some time (for visualisation puproposes) but I not > able to find a routine that returns a time unit > smaller than one second :( > > Any hints ... > > Thanks in advance, > > Cesar For an clock with approximately 1/60 of a second resolution, you can use TickCount() or its friend Delay(). For more accurate timings (down to somewhere under one millisecond), check out the Time Manager (aka the Extended Time Manager these days). It lets you set up an interrupt task to be called after a specific amount of time has elapsed. Hope this helps, -- Anton --------------------------- >From alexsf@nospam.well.com (Alex Liberman) Subject: serial port question Date: Wed, 03 Dec 1997 10:09:39 -0800 Organization: Whole Earth 'Lectronic Link Regarding the serial driver, where does its "open" routine install the interrupt handler, and how would I substitute my own routine in its place? I want to have the serial driver call a read routine everytime it receives data from the modem, without having to poll it in the event loop. That's the point of interrupts? I also keep seeing to use a "deferred task" for this, but I don't want to "defer" anything when the serial port receives data, I want to act on it right away. Thanks! +++++++++++++++++++++++++++ >From DavidO@dascorp.com (David Phillip Oster) Date: Thu, 04 Dec 1997 12:10:27 -0700 Organization: Digital Arts & Sciences Corp. In article , alexsf@well.com (Alex Liberman) wrote: >Regarding the serial driver, where does its "open" routine install the >interrupt handler, and how would I substitute my own routine in its place? >I want to have the serial driver call a read routine everytime it receives >data from the modem, without having to poll it in the event loop. That's >the point of interrupts? You can't install your own interrupt handler without worrying about low-level details of the serial hardware, that it isn't worth your time to know. Instead: read from the serial port using PBReadAsync(). Make sure that the ioParameter block is a global, or allocated with NewPtr(), malloc(), or new, since PBReadAsync returns immediately, but the ioParameter will continue to be in use until the read actually happens, or you PBCancel the io. If you set the ioReqCount field to 1, you'll get called on every character. Set the ioCompletion routine to a UPP for your completion routine. You routine will get called when the io completes, either normally, or with an error. It will get called immediately, and at "interrupt time", which means that you can't call any toolbox call that directly or indirectly calls NewHandle. You can store the character in a previously allocated buffer, (but the serial manager will do that for you already), You can do another PBReadAsync(). Because of the restrictions on what your program can do at interrupt time, it is usually better to give the serial manager a big buffer, set up flow control, and periodically poll the serial manager, asking how many characters it has buffered. If non-zero, read that many. Then, your program can do whatever it wants with the charcters it read. Of course, if you are writing a serial digitizing tablet driver, then it makes sense to do everythng at interrupt time, from a state machine written as a sequence of completion routines. (Since mouse movement can also be done at interrupt time.) -- -- Warning: posted from an unlocked cubicle: no guarantee its really me. "I am Buffie of Borg. Resistance is so totally bogus. You will be, like, assimilated..." (and we give you these bitchin' piercings) +++++++++++++++++++++++++++ >From russotto@wanda.vf.pond.com (Matthew T. Russotto) Date: 4 Dec 1997 22:31:43 -0500 Organization: Ghotinet In article , David Phillip Oster wrote: }Set the ioCompletion routine to a UPP for your completion routine. }You routine will get called when the io completes, either normally, }or with an error. } }It will get called immediately, and at "interrupt time", which }means that you can't call any toolbox call that directly or indirectly }calls NewHandle. You can store the character in a previously allocated }buffer, (but the serial manager will do that for you already), }You can do another PBReadAsync(). } }Because of the restrictions on what your program can do at interrupt }time, it is usually better to give the serial manager a big buffer, }set up flow control, and periodically poll the serial manager, asking }how many characters it has buffered. If non-zero, read that many. }Then, your program can do whatever it wants with the charcters it read. Whatever you do, DON'T try to mix these approaches in a way that leads to making a control call in the completion routine. The deadlocks that result from this are hard to track down, even if you have just read the Tech Note which warns you not to do that. -- Matthew T. Russotto russotto@pond.com "Extremism in defense of liberty is no vice, and moderation in pursuit of justice is no virtue." +++++++++++++++++++++++++++ >From alexsf@nospam.well.com (Alex Liberman) Date: Thu, 04 Dec 1997 23:07:07 -0800 Organization: Whole Earth 'Lectronic Link In article , DavidO@dascorp.com (David Phillip Oster) wrote: > Because of the restrictions on what your program can do at interrupt > time, it is usually better to give the serial manager a big buffer, > set up flow control, and periodically poll the serial manager, asking > how many characters it has buffered. If non-zero, read that many. > Then, your program can do whatever it wants with the charcters it read. >>>>>> and <<< In article , bradley@apple.com (Bob Bradley) wrote: > You can't substitute your own interrupt handler for the one the serial > driver installs. An interrupt handler is not the same as a completion > routine. You'll have to write your own serial driver if you want install > your own interrupt handler. So, I will always have to poll the serial manager? I was hoping the mac would generate interrupts when it is done reading data **and*** when new data has arrived. Isn't that the way the PC does it? That Uh huh huh... sucks :-) It was this line in Inside Mac: Devices, p 1-27, that got my hopes up: > If you do not want your driver to depend on applications to call > WaitNextEvent or SystemTask, you can perform actions periodically > by installing a VBL task, a Deferred Task Manager task, a Time Manager > task, or a Notification Manager task. For more information, see Inside > Macintosh: Processes The only way I thought of doing this otherwise was to put a status check routine in the iocompletion routine, but then again... In article <667siv$aim@wanda.vf.pond.com>, russotto@wanda.vf.pond.com (Matthew T. Russotto) wrote: > Whatever you do, DON'T try to mix these approaches in a way that leads > to making a control call in the completion routine. The deadlocks > that result from this are hard to track down, even if you have just > read the Tech Note which warns you not to do that. On the other hand, > You don't need to [install an interrupt handler] for you want to do though. > If you issue a read, your completion routine will get called when data > comes in so you don't have to poll. but if you read more than comes in, don't you get stuck in a loop? and you still have to read in the event loop or something that gets called regularly. Thanks, I'm just getting started programming so your help is much appreciated! +++++++++++++++++++++++++++ >From bradley@apple.com (Bob Bradley) Date: Fri, 05 Dec 1997 02:29:22 -0800 Organization: Uh huh huh...It says Organ In article , alexsf@nospam.well.com (Alex Liberman) wrote: > So, I will always have to poll the serial manager? I was hoping the mac > would generate interrupts when it is done reading data **and*** when new > data has arrived. Isn't that the way the PC does it? That Uh huh huh... > sucks :-) Your completion routine will get called when the amount of data you requested arrives. +++++++++++++++++++++++++++ >From bradley@apple.com (Bob Bradley) Date: Thu, 04 Dec 1997 12:07:40 -0800 Organization: Uh huh huh...It says Organ In article , alexsf@nospam.well.com (Alex Liberman) wrote: > Regarding the serial driver, where does its "open" routine install the > interrupt handler, and how would I substitute my own routine in its place? > I want to have the serial driver call a read routine everytime it receives > data from the modem, without having to poll it in the event loop. That's > the point of interrupts? You can't substitute your own interrupt handler for the one the serial driver installs. An interrupt handler is not the same as a completion routine. You'll have to write your own serial driver if you want install your own interrupt handler. You don't need to for you want to do though. If you issue a read, your completion routine will get called when data comes in so you don't have to poll. > I also keep seeing to use a "deferred task" for this, but I don't want to > "defer" anything when the serial port receives data, I want to act on it > right away. A deferred task is similar to a completion routine but it gets call after interrupts are re-enabled. You would normally install a deferred task from your completion routine to avoid running with interrupts disabled for a long period of time. +++++++++++++++++++++++++++ >From DavidO@dascorp.com (David Phillip Oster) Date: Fri, 05 Dec 1997 10:10:09 -0700 Organization: Digital Arts & Sciences Corp. In article , alexsf@nospam.well.com (Alex Liberman) wrote: >So, I will always have to poll the serial manager? I was hoping the mac >would generate interrupts when it is done reading data **and*** when new >data has arrived. PBReadAsync one character at a time, and your completion routine will get called when new data arrives. _It_ can decide if you are "done". >but if you read more than comes in, don't you get stuck in a loop? Yes, so don't read more than has come in. >and you >still have to read in the event loop or something that gets called >regularly. Yes, but since your application is polling for events anyway, you can do it right there. I have a long variable, and I just set bits in it for the different kinds of events that can happen. In my event loop I test to see if it is non-zero (a very fast test) then, if it has some bits on in it, dispatch to the appropriate handlers. if you are using WaitNextEvent with a long idle time, there is a reliable way to break out of it early. You can call WakeUpProcess() from your completion routine. Combine those two techniques, and polling becomes very cheap: a long sleep, but the completion routine sets a bit and wakes you up. Sounds as good as an interrupt to me. (no busy waiting, polling the same flag over and over to no effect.) You might consider using PowerPlant, or even just some of the source code from it. The networking classes include some nifty general purpose code for using the thread mananger with asynchronous i/o: They wrap reads and writes, so the thread does an PBReadAsynch or a PBWriteAsync, then that thread goes to sleep. The completion routine wakes the thread up. The tricky part is handling the race conditions, which the PP source code does. (There was also an article in "develop" magazine with a different take on this technique.) >Thanks, I'm just getting started programming so your help is much appreciated! If you are just starting, maybe you should pick something easier. russotto@pond.com (Matthew T. Russotto) writes: >Whatever you do, DON'T try to mix these approaches in a way that leads >to making a control call in the completion routine. The deadlocks >that result from this are hard to track down, even if you have just >read the Tech Note which warns you not to do that. Pardon my ignorance, but I just re-read "Asynchronous Routines on the Mac" from develop 13 (I definately recommend reading this article before doing anything with interrupts or asynchronous i/o ftp://dev.apple.com/devworld/Periodicals/develop/develop13/develop_Issue_13/Aynchronous_Routines_on.sit.hqx and I don't see any problem making an immediate control call on the serial driver from a completion routine of a read on the serial driver. What am I missing? -- -- Warning: posted from an unlocked cubicle: no guarantee its really me. "A proud member of the International Jewish Conspiracy, since 3760 BCE, the original FAMILY-OWNED international conspiracy." _ zionelders@ijc.org +++++++++++++++++++++++++++ >From russotto@wanda.vf.pond.com (Matthew T. Russotto) Date: 5 Dec 1997 20:32:53 -0500 Organization: Ghotinet In article , David Phillip Oster wrote: }russotto@pond.com (Matthew T. Russotto) writes: }>Whatever you do, DON'T try to mix these approaches in a way that leads }>to making a control call in the completion routine. The deadlocks }>that result from this are hard to track down, even if you have just }>read the Tech Note which warns you not to do that. } }Pardon my ignorance, but I just re-read "Asynchronous Routines on the }Mac" from develop 13 (I definately recommend reading this article }before doing anything with interrupts or asynchronous i/o } }ftp://dev.apple.com/devworld/Periodicals/develop/develop13/develop_Issue_13/Aynchronous_Routines_on.sit.hqx } } }and I don't see any problem making an immediate control call on the }serial driver from a completion routine of a read on the serial }driver. What am I missing? I can't find the tech note now (of course), but what I found is that if I called SerGetStatus during the completion routine of the read, the system would lock up solid when I tried to do a KillIO and then close the driver. -- Matthew T. Russotto russotto@pond.com "Extremism in defense of liberty is no vice, and moderation in pursuit of justice is no virtue." --------------------------- >From Alexis Vartanian Subject: under interrupt ? Date: Mon, 08 Dec 1997 19:54:37 +0100 Organization: Universite Paris-Sud, France. Hi Is there a way under MacOS to know whether your ppc code is called normally or under interrupt (ie from a vbl task or async handler) ?. An easy way would be to read the msr register but you need to be supervisor to do that. Alexis ******************************************************* Alexis VARTANIAN - tel: (33) 01 69 15 42 22 Equipe Architectures Paralleles, LRI Batiment 490, Universite Paris-Sud, 91405 Orsay, France ******************************************************* +++++++++++++++++++++++++++ >From bradley@apple.com (Bob Bradley) Date: Tue, 09 Dec 1997 00:31:48 -0800 Organization: Uh huh huh...It says Organ In article <348C426D.64A3@lri.fr>, Alexis Vartanian wrote: > Is there a way under MacOS to know whether your ppc code > is called normally or under interrupt (ie from a vbl task > or async handler) ?. An easy way would be to read the msr > register but you need to be supervisor to do that. You can use the CurrentExecutionLevel() routine in DriverServices.h. +++++++++++++++++++++++++++ >From Alexis Vartanian Date: Thu, 11 Dec 1997 10:55:14 +0100 Organization: Universite Paris-Sud, France. Bob Bradley wrote: > > In article <348C426D.64A3@lri.fr>, Alexis Vartanian wrote: > > > Is there a way under MacOS to know whether your ppc code > > is called normally or under interrupt (ie from a vbl task > > or async handler) ?. An easy way would be to read the msr > > register but you need to be supervisor to do that. > > You can use the CurrentExecutionLevel() routine in DriverServices.h. I tried to use it but it doesn't work. When my function is called from a code called when an asynchronous I/O is completed, the function returns kTaskLevel. And in my function is reentered but I detect it too late. I looked with MacBugs at the CurrentExecutionLevel function and it just looks in memory at address 0x001EF80 and 0x001EF50 to see if thoses values are different from 0. And when an asynchronous call back is called theses adresses hold a 0. Maybe is there a way to detect if we are called from an asynchronous call-back ? Alexis -- ******************************************************* Alexis VARTANIAN - tel: (33) 01 69 15 42 22 Equipe Architectures Paralleles, LRI Batiment 490, Universite Paris-Sud, 91405 Orsay, France ******************************************************* +++++++++++++++++++++++++++ >From bradley@apple.com (Bob Bradley) Date: Thu, 11 Dec 1997 02:32:55 -0800 Organization: Uh huh huh...It says Organ In article <348FB882.1662@lri.fr>, Alexis Vartanian wrote: > called from a code called when an asynchronous I/O is completed, > the function returns kTaskLevel. And in my function is reentered > but I detect it too late. > I looked with MacBugs at the CurrentExecutionLevel function > and it just looks in memory at address 0x001EF80 and 0x001EF50 > to see if thoses values are different from 0. And when an asynchronous > call back is called theses adresses hold a 0. > Maybe is there a way to detect if we are called from an asynchronous > call-back ? CurrentExecutionLevel just checks if you are at hardware interrupt level or secondary interrupt level and otherwise it considers it task level. I assumed you just wanted to know if you were being called from a hardware interrupt handler. If you can give a little more detail as to what you are trying to do, I might be able to give a better answer. --------------------------- >From burglin Subject: utility to send ASCII commands on serial port Date: Thu, 11 Dec 1997 16:45:14 +0100 Organization: Biozentrum Hi, is there a little utility out there that allows me to send Ascii characters out on the serial or modem port? I'd like to test and control some little equipment that can be controlled by ASCII commands through the serial port. Thanks in advance, please reply also using email. Thank you. Thomas Burglin burglin@nixspam.ubaclu.unibas.ch Remove the obvious word to get the correct email. +++++++++++++++++++++++++++ >From J.P.Djajadiningrat@IO.TUDelft.NL (Tom Djajadiningrat) Date: 11 Dec 1997 16:54:43 GMT Organization: TU Delft Thomas, There was info on something like this on the www.macintouch.com site. Key2Serial it was called I think. Good luck, Tom In article <34900A72.791@nixspam.ubaclu.unibas.ch>, burglin@nixspam.ubaclu.unibas.ch wrote: > Hi, > is there a little utility out there that allows me > to send Ascii characters out on the serial or modem port? > > I'd like to test and control some little equipment > that can be controlled by ASCII commands through the > serial port. > > > Thanks in advance, please reply also using email. > > > Thank you. > Thomas Burglin > > burglin@nixspam.ubaclu.unibas.ch Remove the obvious word > to get the correct email. +++++++++++++++++++++++++++ >From jluszcz@best.com (Jeffrey Luszcz) Date: 11 Dec 1997 10:44:43 -0800 Organization: (none) Hi there, I have just released a extension/control panel that allows you to send commands to the serial port at any time. It's called Keyboard2Serial and can be downloaded off my software page at http://www.best.com/~jluszcz/software.html It's much smaller than a terminal emulator and starts up faster. Enjoy, Jeff johns@sonic.net (John Selhorst) writes: >In article <34900A72.791@nixspam.ubaclu.unibas.ch>, >burglin@nixspam.ubaclu.unibas.ch wrote: >>Hi, >>is there a little utility out there that allows me >>to send Ascii characters out on the serial or modem port? >Yes. It is called terminal emulation software. I like ZTerm. >Johnny -- - - jluszcz@best.com http://www.best.com/~jluszcz +++++++++++++++++++++++++++ >From Kevin McGough Date: Thu, 11 Dec 1997 09:25:24 -0800 Organization: University of California, Santa Barbara you should try the serial port oasx (serial port scripting edition) you can find this at http://www.scriptweb.com/ +++++++++++++++++++++++++++ >From johns@sonic.net (John Selhorst) Date: Thu, 11 Dec 1997 10:13:38 -0800 Organization: ohn Selhorst In article <34900A72.791@nixspam.ubaclu.unibas.ch>, burglin@nixspam.ubaclu.unibas.ch wrote: >Hi, >is there a little utility out there that allows me >to send Ascii characters out on the serial or modem port? Yes. It is called terminal emulation software. I like ZTerm. Johnny --------------------------- End of C.S.M.P. Digest **********************