TweetFollow Us on Twitter

Aug 92 Mousehole
Volume Number:8
Issue Number:4
Column Tag:Mousehole

Mousehole

By Larry Nedry, MacTutor Regular Contributing Author

From: Derek

To: ** ALL **

Re: Programming for System 7

I am having some problems trying the code from the book “Programming System 7” to work with my THINK C compiler version 4.05. I keep this error: “Illegal Function Prototype”. (I think it has to do with some System 7 specific toolbox routines?)

I haven’t programmed in a few years and I admit I am a bit rusty with C and the Mac.

Any help that does not include buying an upgrade for my THINK C compiler would be greatly appreciated. (I’ve bought upgrades for all for THINK Pascal and THINK C in the past, but with this recession I admit I am broke currently)

Thanx in advance

From: Tims

To: Derek

Re: Programming for System 7

Derek - I co-authored “Programming for System 7” and all of the sample C source in it relies on Think C v.5.x. If you’re still using pre-5.x, then you’re lacking all of the System 7 interfaces and “Programming for System 7” uses a lot of different System 7 calls. There were also some changes in THINK itself from 4.x to 5.x (I believe 5.x is when they started using Apple’s interfaces so the code can be easily moved between MPW C and THINK C).

The cleanest solution is to upgrade to THINK C v.5.x (I know, $$$$’s tight, but you’re going to spend a LOT more time and effort creating your own System 7 interfaces and tweaking our code to work under 4.0 than you might imagine). Bear in mind that the listings in the book are not the full thing (there’s some behind the scenes “housekeeping” stuff for publish/subscribe, comm toolbox, balloon help, and the desktop database that’s not listed in the book, but is on the disk [see the coupon inside the back cover of the book...]). If you did go to all the trouble of tweaking the listings to work under THINK C 4.x, you’d have to either write your own “behind the scenes” stuff or get the disk and convert that source as well (a fairly major task and not one I’d recommend to anybody). That’s why I say that despite the cost of moving to THINK C 5.x, you’ll come out ahead in the long run.

Hope that helps at least a little.

From: Derek

To: Tims

Re: Programming for System 7

Thank you for the advice. I did buy an upgrade and the disk. (my spouse is out of work, not myself!) I hate to ask such a simple question, but I am getting an error and I can not figure out why.

I get this same error with the code I typed in or from the disk I purchased so I assume it must be my THINK C setup somehow.

pascal OSErr HandleOAPP( AppleEvent *theAppleEvent, AppleEvent *reply, long myRefCon );

On the above line I get a “syntax error” The place in the line it stops with the error is when it gets to the: “*theAppleEvent”.

Sorry to keep asking simple problems but if anyone could help me with this I would really appreciate it.

From: Tims

To: Derek

Re: Programming for System 7

Welcome to THINK’s idea of “System 7 support” <grin>.

The problem you’re encountering is that THINK’s std out-of-the-box MacHeaders file doesn’t bother to include any of the System 7 specific interfaces. You have to include them yourself or edit the Mac #include.c file and re-precompile it (to recreate a more meaningful MacHeaders file).

The disk for the book was supposed to address that problem by using a custom pre-compiled header. Did you open the PROJECT that came with the disk or did you just bring the source files into your existing project?

The Read Me should have some info on the whole situation, but may not (I haven’t read the Read Me since late last year when Gary and I wrote it <grin>).

Hope that helps.

From: Derek

To: Tims

Re: Programming for System 7

Thank you very much for the help. I did include the necessary System 7 headers and now everything works fine.

From: Markspace

To: Tims

Re: C++? (1 reply)

About the only thing I find myself wanting to use under THINK C from C++ is multiple inheritance.

From: Tims

To: Markspace

Re: C++?

I sat in on some heavy arguments on whether or not multiple inheritance was a “useful feature” or a “crutch”. The folks referring to it as a “crutch” claimed that any example you could give them of when MI was “needed”, they could show it could be done without MI, thus MI was merely a crutch that let you avoid “doing your class hierarchy” correctly. I never did completely agree with either side, but it seems to me that any language feature that can bail you out late in a project, even if it is a “crutch” is a heck of a lot more practical than rewriting your class hierarchy from scratch. Somehow the “crutch” crowd didn’t always seem to see the “practical” side of a development tool, preferring to stick to the academic side.

Just a few thoughts from days gone by.

Tim (my opinions are my own and I’m not a super-expert on C++) S.

From: Halldor

To: ** ALL **

Re: DAs and access to selected text in applications

Hello. I am new to Mac programming and, I am writing a program that has to take the text selected in a word processor, modify it and turn it back to the word processor. Is there any reasonable way of doing this on the Mac? Is there any book around that describes DA programming in detail, other than IM, do you know of any DA source code in your library? Thanks for reading this message, a response would be appreciated, if not... thanks anyway!!

From: Mrteague

To: Halldor

Re: DAs and access to selected text in applications

Although you are new to Mac programming, can you tell me if you intend using the code you mention for something more than an example? The reason I ask, if you want to jump in at the deep end, and have an application that would require System 7.0.x, then you might want to consider using AppleEvents - your example would be an ideal use of AppleEvents, especially considering the Word Services AppleEvent Registry is almost complete, and this registry is designed for the very thing you ask. However I will assume for the moment that you don’t want something so difficult to start with <grin> - you shouldn’t need to even worry about writing a DA (especially since System 7.0.x discourages such things), since standard applications that use the Clipboard correctly will work as you intend without a DA. Suggest you get a hold of the standard Apple example source code (it comes with MPW, and may be available separately, maybe even from here). The important things to remember are: handle resume/suspend events if running under MultiFinder/ System 7.0.x (and set the appropriate bits in the ‘SIZE’ resource - you can get away with not doing this, but MultiFinder(?) Process Manager will “fake” Clipboard copy/paste like a DA and it will be a little slower than you doing it); and convert between any private “scrap” you may have and the public “scrap” (Clipboard). The operating System will take care of updating the Clipboard in both applications, if both you and the other application do the correct thing. HOWEVER, none of this (and DA’s without a lot of work) will help your application REPLACE the selected text in the word-processing application - to do this usually requires some kind of INIT, and lots of horrible behind the scenes fiddling with TextEdit (and won’t work with all applications) - I liken your example to a Spelling Checker, and I’m sure other people will tell you what kinds of lengths Spelling Checkers go to, to work with applications. Hope this helps.

From: Halldor

To: Mrteague

Re: DAs and access to selected text in applications

Thanks this helps a lot, I was hoping that there was a quick (and maybe dirty) way of doing this. The reason for all this is that English is my second language, (Icelandic being the first one) and I’ve written a translation program that does a lot of the dictionary flipping for me. I wanted to see if there was an easy way of extending the program to communicate with applications. Thanks for the help, I’ll turn to 7.0.x for completing the task.

From: Sysop

To: Dizzy

Re: Quadra 900

My Quadra seems to be faster for everything I do. It is faster for hard disk usage, network and running applications. I have run into a few apps that will not run with the ‘040 caches turned on but that is easy to fix with a cdev called Compatible. It turns the cache off when selected apps are run. Even QuickTime movies are much smoother.

From: Sysop

To: ** ALL **

Re: Quadra 900 with OverDrive

I just purchased an OverDrive kit from Newer Technology. It is a small card that plugs into the ROM socket on the Quadra 900 that speeds up the CPU to 33 MHz. It was fairly easy to install and my Quadra is now running 32% faster. It is definitely noticeable. I love it!

I ran Speedometer 3.06 before and after. The results are:

Before After

CPU 16 22

Graphics 19 25

Disk 4 4

Math 102 136

These results show how much faster this machine is with the OverDrive kit.

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Call of Duty Warzone is a Waiting Simula...
It's always fun when a splashy multiplayer game comes to mobile because they are few and far between, so I was excited to see the notification about Call of Duty: Warzone Mobile (finally) launching last week and wanted to try it out. As someone who... | Read more »
Albion Online introduces some massive ne...
Sandbox Interactive has announced an upcoming update to its flagship MMORPG Albion Online, containing massive updates to its existing guild Vs guild systems. Someone clearly rewatched the Helms Deep battle in Lord of the Rings and spent the next... | Read more »
Chucklefish announces launch date of the...
Chucklefish, the indie London-based team we probably all know from developing Terraria or their stint publishing Stardew Valley, has revealed the mobile release date for roguelike deck-builder Wildfrost. Developed by Gaziter and Deadpan Games, the... | Read more »
Netmarble opens pre-registration for act...
It has been close to three years since Netmarble announced they would be adapting the smash series Solo Leveling into a video game, and at last, they have announced the opening of pre-orders for Solo Leveling: Arise. [Read more] | Read more »
PUBG Mobile celebrates sixth anniversary...
For the past six years, PUBG Mobile has been one of the most popular shooters you can play in the palm of your hand, and Krafton is celebrating this milestone and many years of ups by teaming up with hit music man JVKE to create a special song for... | Read more »
ASTRA: Knights of Veda refuse to pump th...
In perhaps the most recent example of being incredibly eager, ASTRA: Knights of Veda has dropped its second collaboration with South Korean boyband Seventeen, named so as it consists of exactly thirteen members and a video collaboration with Lee... | Read more »
Collect all your cats and caterpillars a...
If you are growing tired of trying to build a town with your phone by using it as a tiny, ineffectual shover then fear no longer, as Independent Arts Software has announced the upcoming release of Construction Simulator 4, from the critically... | Read more »
Backbone complete its lineup of 2nd Gene...
With all the ports of big AAA games that have been coming to mobile, it is becoming more convenient than ever to own a good controller, and to help with this Backbone has announced the completion of their 2nd generation product lineup with their... | Read more »
Zenless Zone Zero opens entries for its...
miHoYo, aka HoYoverse, has become such a big name in mobile gaming that it's hard to believe that arguably their flagship title, Genshin Impact, is only three and a half years old. Now, they continue the road to the next title in their world, with... | Read more »
Live, Playdate, Live! – The TouchArcade...
In this week’s episode of The TouchArcade Show we kick things off by talking about all the games I splurged on during the recent Playdate Catalog one-year anniversary sale, including the new Lucas Pope jam Mars After Midnight. We haven’t played any... | Read more »

Price Scanner via MacPrices.net

Deal Alert! B&H Photo has Apple’s 14-inch...
B&H Photo has new Gray and Black 14″ M3, M3 Pro, and M3 Max MacBook Pros on sale for $200-$300 off MSRP, starting at only $1399. B&H offers free 1-2 day delivery to most US addresses: – 14″ 8... Read more
Department Of Justice Sets Sights On Apple In...
NEWS – The ball has finally dropped on the big Apple. The ball (metaphorically speaking) — an antitrust lawsuit filed in the U.S. on March 21 by the Department of Justice (DOJ) — came down following... Read more
New 13-inch M3 MacBook Air on sale for $999,...
Amazon has Apple’s new 13″ M3 MacBook Air on sale for $100 off MSRP for the first time, now just $999 shipped. Shipping is free: – 13″ MacBook Air (8GB RAM/256GB SSD/Space Gray): $999 $100 off MSRP... Read more
Amazon has Apple’s 9th-generation WiFi iPads...
Amazon has Apple’s 9th generation 10.2″ WiFi iPads on sale for $80-$100 off MSRP, starting only $249. Their prices are the lowest available for new iPads anywhere: – 10″ 64GB WiFi iPad (Space Gray or... Read more
Discounted 14-inch M3 MacBook Pros with 16GB...
Apple retailer Expercom has 14″ MacBook Pros with M3 CPUs and 16GB of standard memory discounted by up to $120 off Apple’s MSRP: – 14″ M3 MacBook Pro (16GB RAM/256GB SSD): $1691.06 $108 off MSRP – 14... Read more
Clearance 15-inch M2 MacBook Airs on sale for...
B&H Photo has Apple’s 15″ MacBook Airs with M2 CPUs (8GB RAM/256GB SSD) in stock today and on clearance sale for $999 in all four colors. Free 1-2 delivery is available to most US addresses.... Read more
Clearance 13-inch M1 MacBook Airs drop to onl...
B&H has Apple’s base 13″ M1 MacBook Air (Space Gray, Silver, & Gold) in stock and on clearance sale today for $300 off MSRP, only $699. Free 1-2 day shipping is available to most addresses in... Read more
New promo at Visible: Buy a new iPhone, get $...
Switch to Visible, and buy a new iPhone, and Visible will take $10 off their monthly Visible+ service for 24 months. Visible+ is normally $45 per month. With this promotion, the cost of Visible+ is... Read more
B&H has Apple’s 13-inch M2 MacBook Airs o...
B&H Photo has 13″ MacBook Airs with M2 CPUs and 256GB of storage in stock and on sale for $100 off Apple’s new MSRP, only $899. Free 1-2 day delivery is available to most US addresses. Their... Read more
Take advantage of Apple’s steep discounts on...
Apple has a full line of 16″ M3 Pro and M3 Max MacBook Pros available, Certified Refurbished, starting at $2119 and ranging up to $600 off MSRP. Each model features a new outer case, shipping is free... Read more

Jobs Board

Medical Assistant - Surgical Oncology- *Apple...
Medical Assistant - Surgical Oncology- Apple Hill Location: WellSpan Medical Group, York, PA Schedule: Full Time Sign-On Bonus Eligible Remote/Hybrid Regular Apply Read more
Omnichannel Associate - *Apple* Blossom Mal...
Omnichannel Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Business Analyst | *Apple* Pay - Banco Popu...
Business Analyst | Apple PayApply now " Apply now + Apply Now + Start applying with LinkedIn Start + Please wait Date:Mar 19, 2024 Location: San Juan-Cupey, PR Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.