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

Top Mobile Game Discounts
Every day, we pick out a curated list of the best mobile discounts on the App Store and post them here. This list won't be comprehensive, but it every game on it is recommended. Feel free to check out the coverage we did on them in the links... | Read more »
Price of Glory unleashes its 1.4 Alpha u...
As much as we all probably dislike Maths as a subject, we do have to hand it to geometry for giving us the good old Hexgrid, home of some of the best strategy games. One such example, Price of Glory, has dropped its 1.4 Alpha update, stocked full... | Read more »
The SLC 2025 kicks off this month to cro...
Ever since the Solo Leveling: Arise Championship 2025 was announced, I have been looking forward to it. The promotional clip they released a month or two back showed crowds going absolutely nuts for the previous competitions, so imagine the... | Read more »
Dive into some early Magicpunk fun as Cr...
Excellent news for fans of steampunk and magic; the Precursor Test for Magicpunk MMORPG Crystal of Atlan opens today. This rather fancy way of saying beta test will remain open until March 5th and is available for PC - boo - and Android devices -... | Read more »
Prepare to get your mind melted as Evang...
If you are a fan of sci-fi shooters and incredibly weird, mind-bending anime series, then you are in for a treat, as Goddess of Victory: Nikke is gearing up for its second collaboration with Evangelion. We were also treated to an upcoming... | Read more »
Square Enix gives with one hand and slap...
We have something of a mixed bag coming over from Square Enix HQ today. Two of their mobile games are revelling in life with new events keeping them alive, whilst another has been thrown onto the ever-growing discard pile Square is building. I... | Read more »
Let the world burn as you have some fest...
It is time to leave the world burning once again as you take a much-needed break from that whole “hero” lark and enjoy some celebrations in Genshin Impact. Version 5.4, Moonlight Amidst Dreams, will see you in Inazuma to attend the Mikawa Flower... | Read more »
Full Moon Over the Abyssal Sea lands on...
Aether Gazer has announced its latest major update, and it is one of the loveliest event names I have ever heard. Full Moon Over the Abyssal Sea is an amazing name, and it comes loaded with two side stories, a new S-grade Modifier, and some fancy... | Read more »
Open your own eatery for all the forest...
Very important question; when you read the title Zoo Restaurant, do you also immediately think of running a restaurant in which you cook Zoo animals as the course? I will just assume yes. Anyway, come June 23rd we will all be able to start up our... | Read more »
Crystal of Atlan opens registration for...
Nuverse was prominently featured in the last month for all the wrong reasons with the USA TikTok debacle, but now it is putting all that behind it and preparing for the Crystal of Atlan beta test. Taking place between February 18th and March 5th,... | Read more »

Price Scanner via MacPrices.net

AT&T is offering a 65% discount on the ne...
AT&T is offering the new iPhone 16e for up to 65% off their monthly finance fee with 36-months of service. No trade-in is required. Discount is applied via monthly bill credits over the 36 month... Read more
Use this code to get a free iPhone 13 at Visi...
For a limited time, use code SWEETDEAL to get a free 128GB iPhone 13 Visible, Verizon’s low-cost wireless cell service, Visible. Deal is valid when you purchase the Visible+ annual plan. Free... Read more
M4 Mac minis on sale for $50-$80 off MSRP at...
B&H Photo has M4 Mac minis in stock and on sale right now for $50 to $80 off Apple’s MSRP, each including free 1-2 day shipping to most US addresses: – M4 Mac mini (16GB/256GB): $549, $50 off... Read more
Buy an iPhone 16 at Boost Mobile and get one...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering one year of free Unlimited service with the purchase of any iPhone 16. Purchase the iPhone at standard MSRP, and then choose... Read more
Get an iPhone 15 for only $299 at Boost Mobil...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering the 128GB iPhone 15 for $299.99 including service with their Unlimited Premium plan (50GB of premium data, $60/month), or $20... Read more
Unreal Mobile is offering $100 off any new iP...
Unreal Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering a $100 discount on any new iPhone with service. This includes new iPhone 16 models as well as iPhone 15, 14, 13, and SE... Read more
Apple drops prices on clearance iPhone 14 mod...
With today’s introduction of the new iPhone 16e, Apple has discontinued the iPhone 14, 14 Pro, and SE. In response, Apple has dropped prices on unlocked, Certified Refurbished, iPhone 14 models to a... Read more
B&H has 16-inch M4 Max MacBook Pros on sa...
B&H Photo is offering a $360-$410 discount on new 16-inch MacBook Pros with M4 Max CPUs right now. B&H offers free 1-2 day shipping to most US addresses: – 16″ M4 Max MacBook Pro (36GB/1TB/... Read more
Amazon is offering a $100 discount on the M4...
Amazon has the M4 Pro Mac mini discounted $100 off MSRP right now. Shipping is free. Their price is the lowest currently available for this popular mini: – Mac mini M4 Pro (24GB/512GB): $1299, $100... Read more
B&H continues to offer $150-$220 discount...
B&H Photo has 14-inch M4 MacBook Pros on sale for $150-$220 off MSRP. B&H offers free 1-2 day shipping to most US addresses: – 14″ M4 MacBook Pro (16GB/512GB): $1449, $150 off MSRP – 14″ M4... Read more

Jobs Board

All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.