America Online APPLE II DEVELOPMENT FORUM CONFERENCE LOG Tuesday, May 11, 1993 10:00 p.m. Eastern Time Topic: Programming with Resources Forum Leader: Gary Jacobson (AFL GaryJ) AFL GaryJ Welcome to the Apple II Development Forum! AFL GaryJ Tonight, our topic is Programming with Resources. AFL GaryJ Let's start off with questions/comments, etc. Salinay How do you do it? Salinay How do you begin? Sheppy Oooh, I like that one. Cuts right to the bone. :) Salinay :> AFL GaryJ :) Sheppy Step 1: Get the Toolbox Reference, Volume 3. Sheppy Step 2: Read the chapter on the Resource Manager. Salinay Where? Salinay Mall, online? AFL GaryJ Resource Central has Toolbox Ref vol 3. Sheppy Resource Central carries it. I don't know how to reach them, offhand. AFA AndyW 3: Get the System 6 programmers reference.. AFL GaryJ You can contact A2 Ellen online, if you want. Sheppy Yes. The PR6 is necessary, too, these days. AFL Marty You can send EMail to A2 Ellen to get info on the products carried AFL Marty by Resource Central. AFL GaryJ Or call: 913-469-6502 Sheppy Yes. :) AFL GaryJ Or write: P.O. Box 11250, Overland Park, KS 66207 Barnabas Of course, it goes without saying you should have Toolbox Ref.'s 1&2 also. Sheppy Sure, althogh you don't really need them if all you care about are resources. Sheppy :) Barnabas Can't do anything with just resources. Sheppy Not true. You just can't do anything _useful_ with just resources. :) Sheppy Hey, Jawaid! You honor us with your divine presence! :) AFL Marty One thing I've noticed about programming... it ain't as easy as reading AFL Marty the manuals. Salinay Is there software I need? AFA AndyW Yes.. Sheppy Well, you need a programming language. Other than that, unless you want to AFL GaryJ Yes, you need a resource editor of some kind. Sheppy ... er, yes. A resource editor or compiler would be nice. :) AFA AndyW Resource compiler, resource editor.. GNO Jawaid You need a multitasking operating system extension + shell :) AFL GaryJ Not necessarily, Jawaid (although, nice plug :) Sheppy Reading the manuals is a pain -- I prefer to learn by doing. Sheppy Jawaid wins the Plug of the Year Award! :) Spottysoft Hi Shep.... (I got my Orca/C!!!!!! :D) AFL Marty I guess I'm a slow study. Sheppy Congrats, Spotty (maybe). Does it work for you? :) Salinay Multi-Tasker I can get, but compiler? Do they hve a compiler/editor online? Spottysoft <---afraid to install it now :) AFL GaryJ The most supported resource editor right now is Foundation. AFA AndyW Yeah.. I wouldn't be too quick to rave about 2.0.. Sheppy Nope. You'll have to get either Foundation (a good move) or Rez (an okay Sheppy move). AFL GaryJ They have an area online attached to our Company Support area (Lunar Productions) Salinay Are they in the library? AFL GaryJ M Wolfgram online attends to that area (and I was hoping that he'd be here tonight) AFL Marty I got something in the mail about Object Oriented Pascal today. TarbabyMN Who has a "C" learning program they want to sell me? Barnabas I got that a few days ago... GNO Jawaid Marty - me too :) Sheppy ORCA/Pascal 2.0? Not particularly interested, myself. I haven't gotten any- Sheppy thing about it, although I figure I will someday. :) AFL GaryJ "C" Learning program? You mean a course, book, whatever? TarbabyMN Disk with manual Spottysoft Shep... I got a flyer the day before Orca/C showed up :) Sheppy Really, Spotty? Pfft. Figures. :) AFL Marty I think I'll pass on that. I've sunk enough money into that language already. Spottysoft (Shep... the only thing from Byte Works that I DON'T own is Orca/Pascal....) Spottysoft (They like me... :) AFA AndyW Same here Larry.. Sheppy Really, Spotty? Hmmm. Salinay How do you get foundation? AFL Marty You buy it, Salinay. Salinay Where? Salinay Online? AFA AndyW You can order it from Lunar productions.. Sheppy Buy it, Salinay. :) Head for the Lunar Productions CS area in Developer Forum. AFL GaryJ You can order it online, from M Wolfgram (screen name) AFA AndyW Yes.. Send Email to M Wolfgram.. Salinay ok AFL GaryJ As I mentioned, they have an area online: "Lunar Productions". It can be found AFL GaryJ in the Company Support area here in ADV. James S WI You can also order Foundation from Resource Central. AFL GaryJ That is true. AFA AndyW Marc will be here shortly.. AFL GaryJ (Good point) Salinay howmuch? Sheppy True. They also advertise in GS+ Magazine frequently. Salinay How muc will it cost? Sheppy I think it retails for $79.95. I got it at a show price. :) AFL GaryJ Looking... Barnabas The problem is, of course, that it doesn't do the really good stuff it is Barnabas supposed to (eventually) do... Sheppy That's because nobody's written any editors for it yet. I don't have the time, Sheppy but might go for it this summer. Barnabas (It's called Vaporfeatures). Sheppy (assuming I'm near a IIGS) Barnabas That's because none of the conditional stuff is in Foundation yet, so you Barnabas can't DO editors for things like Controls, etc. AFL GaryJ (Still looking here :) Sheppy I already said: $79.95. Sheppy (according to the ads in GS+) AFL GaryJ Ah...(finally) Salinay Sorry, doing 3 things at once! Sheppy Yes -- double checked and verified. I remembered it right. :) AFL GaryJ One thing bad about the Resource Central catalogs, is that they don't list EVERYTHING AFL GaryJ in every one of them. In the March 1993 catalog they list Foundation for $59.95. Sheppy It's... HIM! :) AFA AndyW Thar he is.. M Wolfgram No not HIM :) AFL GaryJ Hi Marc :) AFA AndyW Resource Central carries it too.. Spottysoft ($79.95 is the retail... mail order price is what Gary just put :)) AFL GaryJ Yeah, that's what I just listed: Resource Central has it for $59.95 M Wolfgram Yes... Gary... Everyone can (and should) get Foundation from Resource Central :) Barnabas Hi Marc. We were just complai... er, commenting about Foundation. AFL GaryJ Yes, as a matter of fact :) M Wolfgram Andy called and rattled my cage. AFL Marty Or you could get it from Lunar Productions. I hear they're online. AFL GaryJ Salinay has had a number of questions about how to get started in resource programming, Marc. M Wolfgram That's the rumor, Marty. Sheppy (we already covered: get the toolbox references... :) AFL GaryJ We promptly recommended Genesys, but someone else reminded us about Foundation ;) Salinay Shoot! Times up, if some knowledgable person could E-Mail me? Salinay Please! Barnabas And somebody said "What's Foundation?" But nobody seemed to know... Then Barnabas somebody said "Doesn't that Wolfgram fellow know?" And someone else said... :) M Wolfgram That's nice... if you're looking for instant graphic editors, try and find Genesys (safe bet - you M Wolfgram won't be able too) M Wolfgram If you're real patient, or a hacker like most of us, curl up with TBR3 and Foundation or LLRE. AFL Marty That's a little like asking someone to mail you information on how to build AFL Marty a house. AFL GaryJ (Exactly what I was thinking, Marty :) Sheppy Yes, it is. Those questions were a little broad... Sheppy Might as well ask: "how do you program?" Sheppy (answer: very carefully...) AFL GaryJ :) M Wolfgram Generally, general questions are pretty general. AFL Marty (an obvious allusion to Foundation if ever I heard one) :) Spottysoft What's wrong with a little broad??? :) Barnabas ;) AFL Marty Nothing, as long as the broad's not too broad. Barnabas I have a question about resources and the Foolbox. James S WI LOL GNO Jawaid Cute. Sheppy (Greg doesn't like resources -- look out) M Wolfgram Where do you want to start with resources? It's not a simple question. (Tammy says the "broad" stuff M Wolfgram is tacky) M Wolfgram Foolbox? AFL GaryJ Go for it, Barnabas Barnabas I've heard that it isn't safe to use one resource for more than on thing at Sheppy What do you expect from this pathetic crowd? Great literature? Hah! :) Barnabas a time (i.e. multiple controls referring to the same string, etc.). AFL GaryJ You can never tell where it's been, Barnabas. Barnabas The reason is because the tools make the resources purgeable when you dispose Barnabas of the control. My question is, it should be safe to do this as long as you Barnabas dispose of all the controls at the same time, right? (like, along with the Barnabas window...) Sheppy I do this all the time -- my guess is it's fine as long as you just let Sheppy CloseWindow dispose of your controls, yeah. AFA AndyW Or copy the ones you want to keep around.. Sheppy That, too. AFL GaryJ I can't think of any other reason myself. Barnabas That's a pain, Andy, because it defeats the whole purpose of the NewWindow2 Barnabas call. (well, most of it) Sheppy Or detach the resources in question the first time through. Then you don't Sheppy need two identical resources. Barnabas (and NewControl2, 2) GNO Jawaid Right. GNO Jawaid (oh yeah, I'm back :-) Sheppy Mmmm. No, actually, detaching them would screw up the works, since the CM Sheppy would be trying to refer to resources that had been detached. Although, I Sheppy ... no, probably a bad idea. M Wolfgram The primary danger in multiple resources is with things like shared items in different areas... Barnabas Of course, I should really ask Dave about it, but he's never here anymore. Barnabas (And I like to have three reasons before I call him :) Sheppy He popped up on comp.sys.apple2 a few days ago, briefly... Sheppy He must be busy lately. AFL GaryJ Must be :) M Wolfgram Like the same "OK" string referenced in the two windows. It gets disposed when one of the windows GNO Jawaid I think Dave's busy getting a certain you-know-what out the door :) Sheppy (Is that a good sign? :) Barnabas Probably only popped up because he's from a Plural sector. :) Sheppy Possibly, yeah. AFL GaryJ What, Nifty List 7.0? AFA AndyW Marc, I got that AOMac2GS utility done already! AFA AndyW Try 1.7.. M Wolfgram is closed. Leaving a gaping hole in the other's data. GNO Jawaid No, not NiftyList :) GNO Jawaid YOU know. :) AFA AndyW Whoops.. That's GSBug.. AFL GaryJ Oh! The *other* thing :) Sheppy Yeah; that's what we're getting at. You need to carefully plan these things Sheppy out to avoid multiply-used resources being disposed while being used by two Sheppy or more controls. Barnabas So, I'm perfectly OK sharing, as long as I treat them as a group... M Wolfgram Using the same divider in a main menu is OK, because the menu stays around. Sheppy Yeah. Barnabas That's what I thought, but I wasn't sure, because I'm thinking there could be Sheppy To be honest, this whole thing never actually occurred to me before. :) Barnabas a "window of vulnerability", where the Control manager is disposing of the Barnabas controls in a window, something comes up (like an AppleTalk alert) that changes Sheppy Hmph. I'm sure a new version of Nifty List and of GSBug will be out at, Sheppy amazingly, about the same time as 6.0.1 comes out. Don't ask why I think that. Sheppy :) Barnabas memory, the string gets purged, control manager tries something silly...I dunno Barnabas (You can see I don't really trust the Foo.. er, Toolbox. GNO Jawaid Greg - I'm sure that AppleTalk alerts are handled through the Scheduler. M Wolfgram The resources are not purgable when they're in use. Barnabas Oh, it's not in the libraries, Salinay... :) Sheppy Yes, I am too. Spottysoft ("The Toolbox is your friend".... :) Barnabas No, but the first control to be killed makes the shared resource go away. Sheppy ("Be one with the Toolbox, and your life will be free of anguish.") Spottysoft (or am I getting the Installer mixed up with that? :) GNO Jawaid And Dave is the friend of the Toolbox :) M Wolfgram (I am your friend) AFA AndyW GSBug and NL will be updated, if for nothing else, to reflect new tool calls.. Barnabas Actually, I go on the principle "The Toolbox is your tool." Barnabas (So use tool patches for everything!) Sheppy Exactly, Andy... that was my point. :) Barnabas (But you should probably wait until I get through rewriting Tech Note #87) GNO Jawaid Hamburger Helper is your friend :) Sheppy Greg: if you distrust the tools, rewrite them. ;) Spottysoft ("You need a proper "foundation" in order to unleash the power of the Toolbox") Spottysoft :) M Wolfgram :) Barnabas Easier to just patch them so you can do sneaky things behind their backs... :) AFL GaryJ YOU are re-writing TN #87, Barnabas? :) Spottysoft (it's a little hard to sneak around Matt tho :) GNO Jawaid Which one is TN #87? Sheppy He is. Really. I think it's even official. AFL GaryJ Officially? Neat. Sheppy That's the "how to patch the tool dispatch vector" note. Barnabas Tech. Note #87 is the poorly written tech note about patching the Dispatcher. AFL GaryJ I thought you were kidding (sorry :) Barnabas (The source code looks like the output of MPW C IIGS). GNO Jawaid It's not _that_ bad, Greg. I figured it out. Sheppy An easy mistake -- hard to imagine Greg writing anything. Barnabas I'm not talking hard to figure out, Jawaid. I'm talking large and inefficient. AFL GaryJ No, not at all, I was just wondering how he was going to squeak it by Dave and Matt :) GNO Jawaid Greg - while you're at it, do a similar one for GS/OS patches. What with Barnabas (Lagae obviously never heard of subroutines and loops). GNO Jawaid GNO, HP, GSBug, ORCA, etc. all patching GS/OS, we could use it! :) Barnabas Matt won't have anything to do with that Tech. Note. And I'm rewriting it Barnabas because a) I've always complained about the sample code and b) it turns out Barnabas there is a flaw in the mechanism. AFA AndyW Only way to do a proper GSOS patch is to leave a stub when your program quits.. GNO Jawaid Okay, which flaw? Sheppy I agree, Jawaid. I think the same mechanism (or a very similar one) should Barnabas (Of course, it isn't official until it gets on paper). Sheppy be used for GS/OS. Barnabas Ever tried removing an extension (CDA, NDA, etc.) that has tool patches, with Sheppy (In fact, one of my programs actually goes ahead and does just that... :) Barnabas IR? Depending on circumstances, it can crash. GNO Jawaid But do all these extensions use the mechanism? Barnabas Because the Lagae Method (read: Lousy Method) makes self-references to itself. GNO Jawaid And it's redundant, too :) Barnabas Anybody patching the Dispatcher uses this method. GNO Jawaid Greg- ahem. In an ideal world, yes. Just say "I'm talking about a situation Sheppy (supposedly, Greg) GNO Jawaid where all application-patched tools use the #87 mechanism" Barnabas No, there is only one way to patch the Dispatcher legally, unless you are the Barnabas first person to patch it... (OK, I know GSBug cheats... so it should always be Sheppy That doesn't mean everyone does it that way, Greg. I _know_ you're not the Barnabas the first person). Sheppy "follow the 55 mph limit" kind of guy... :) Barnabas Yes, there are undoubtedly idiots out there who patch the Tool Dispatcher Barnabas illegally (for no good reason, I might add), and they keep other legal patchers Sheppy (Hey! I've done that! 'Course, that was before TN #87 came out... :) GNO Jawaid And so is there one of these idiotic programs in your test case? Barnabas from removing themselves...) Sheppy Crash 'em! :) Barnabas The Tool Dispatch mechanism cannot remove a patch in such a case-- either with Sheppy Greg, you need to consider the likelihood that there is an illegal patch Sheppy installed. Barnabas my method or the Lagae method-- and so it returns an error code. It is up to Barnabas the person using the code to not remove themselves from memory under these Sheppy True. Barnabas circumstances. A better thing to do would be to get the filename of the Barnabas program making the illegal patch, present it in a dialog to the user, Sheppy Put up an alert: "The extension xxx is garbage.". :) Sheppy Cart over the Mac's bomb icon. :) Barnabas explaining that it is interfering with the system and should be removed as Barnabas soon as possible, and the author should be informed. That's just my GNO Jawaid Yeah, yeah, but what's the problem? :) Barnabas recommendation, of course. Barnabas The problem is, the first tool patch in the chain (i.e. the last one installed Barnabas ), when called through the primary dispatch vector (the one usually used), Barnabas pushes the address of an RTL which is REQUIRED by the Lagae method to be Barnabas imbedded in a certain place in the program. Thus, if you try to remove a Barnabas Tool Dispatcher patch inside a toolcall (usually an SRQGoAway), there are Barnabas RTL's on the stack pointing to your code, which may not be there anymore. GNO Jawaid Hardly his Legae's fault for assuming that application patches would be Barnabas (So the system may crash). GNO Jawaid removed by the application. This was before SRQGoAway Barnabas Yes, but it wasn't before the invention of Assembly language! AFL GaryJ :) Barnabas (And there is an implicit assumption that the ability to remove a patch means Sheppy True, Jawaid. I didn't use it back then -- did IR try to remove stuff in Sheppy those days? Barnabas that it might not stay around in the system... It could have chosen to go away Barnabas as the result of a tool call, for instance, and that would cause similar probs) Barnabas Actually, I must admit I was glad to find the problem so that the code could Barnabas be rewritten. One reason people break rules like this is that few people Barnabas actually have the patience to type in all the garbage code in that technote Barnabas (I have a version of that code that is only 43% of the size, for instance). GNO Jawaid Greg, that's like saying that few people have time to learn GS/OS, so they GNO Jawaid end up using SmartPort calls instead. GNO Jawaid Greg - so upload it! :) Sheppy :) Barnabas I was going to, Jawaid (it is the code used in Twilight II, BTW), but then Barnabas I found this other problem, so I'm going to provide new code to Apple (alas Barnabas that finals are next week!) GNO Jawaid Hamburger Helper "Lasagne" is Yummy! Sheppy I envy your "finals are next week". Mine aren't for a month yet. Barnabas Actually, the T2 code is the stuff that is like 70% of the size... it's old Barnabas stuff. Sheppy Tsk. Jawaid, the HH Lasagne is only so-so. The Beef Teryaki is much better. GNO Jawaid Are we talking the stuff actually inside the dispatcher vector (i.e., timing GNO Jawaid critical stuff?) or just the hook/unhook routines? Sheppy Hook/unhook, I believe. Barnabas Just the hook/unhook routines. We're talking size, not timing. Unfortunately, Barnabas the new method will require a tiny bit more overhead for the first tool patch Barnabas in the chain (but, since there can only be one first tool patch, it is Barnabas pretty much irrelevant). GNO Jawaid As long as it's 100% compatible with existing versions of TN #87 GNO Jawaid go for it :) Barnabas That's the trick, of course. To be compatible, it has to search through the Barnabas chain until it finds the last of the old-style patches, and install itself Sheppy Say, Greg -- we need to remember to install that new code into our program. Barnabas after it... because old-style patches can't understand the new-style. (Lagae Barnabas makes sure all the patch code is the same, so that no new patch mechanism could Barnabas ever be done without this step).