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

Tokkun Studio unveils alpha trailer for...
We are back on the MMORPG news train, and this time it comes from the sort of international developers Tokkun Studio. They are based in France and Japan, so it counts. Anyway, semantics aside, they have released an alpha trailer for the upcoming... | Read more »
Win a host of exclusive in-game Honor of...
To celebrate its latest Jujutsu Kaisen crossover event, Honor of Kings is offering a bounty of login and achievement rewards kicking off the holiday season early. [Read more] | Read more »
Miraibo GO comes out swinging hard as it...
Having just launched what feels like yesterday, Dreamcube Studio is wasting no time adding events to their open-world survival Miraibo GO. Abyssal Souls arrives relatively in time for the spooky season and brings with it horrifying new partners to... | Read more »
Ditch the heavy binders and high price t...
As fun as the real-world equivalent and the very old Game Boy version are, the Pokemon Trading Card games have historically been received poorly on mobile. It is a very strange and confusing trend, but one that The Pokemon Company is determined to... | Read more »
Peace amongst mobile gamers is now shatt...
Some of the crazy folk tales from gaming have undoubtedly come from the EVE universe. Stories of spying, betrayal, and epic battles have entered history, and now the franchise expands as CCP Games launches EVE Galaxy Conquest, a free-to-play 4x... | Read more »
Lord of Nazarick, the turn-based RPG bas...
Crunchyroll and A PLUS JAPAN have just confirmed that Lord of Nazarick, their turn-based RPG based on the popular OVERLORD anime, is now available for iOS and Android. Starting today at 2PM CET, fans can download the game from Google Play and the... | Read more »
Digital Extremes' recent Devstream...
If you are anything like me you are impatiently waiting for Warframe: 1999 whilst simultaneously cursing the fact Excalibur Prime is permanently Vault locked. To keep us fed during our wait, Digital Extremes hosted a Double Devstream to dish out a... | Read more »
The Frozen Canvas adds a splash of colou...
It is time to grab your gloves and layer up, as Torchlight: Infinite is diving into the frozen tundra in its sixth season. The Frozen Canvas is a colourful new update that brings a stylish flair to the Netherrealm and puts creativity in the... | Read more »
Back When AOL WAS the Internet – The Tou...
In Episode 606 of The TouchArcade Show we kick things off talking about my plans for this weekend, which has resulted in this week’s show being a bit shorter than normal. We also go over some more updates on our Patreon situation, which has been... | Read more »
Creative Assembly's latest mobile p...
The Total War series has been slowly trickling onto mobile, which is a fantastic thing because most, if not all, of them are incredibly great fun. Creative Assembly's latest to get the Feral Interactive treatment into portable form is Total War:... | Read more »

Price Scanner via MacPrices.net

Early Black Friday Deal: Apple’s newly upgrad...
Amazon has Apple 13″ MacBook Airs with M2 CPUs and 16GB of RAM on early Black Friday sale for $200 off MSRP, only $799. Their prices are the lowest currently available for these newly upgraded 13″ M2... Read more
13-inch 8GB M2 MacBook Airs for $749, $250 of...
Best Buy has Apple 13″ MacBook Airs with M2 CPUs and 8GB of RAM in stock and on sale on their online store for $250 off MSRP. Prices start at $749. Their prices are the lowest currently available for... Read more
Amazon is offering an early Black Friday $100...
Amazon is offering early Black Friday discounts on Apple’s new 2024 WiFi iPad minis ranging up to $100 off MSRP, each with free shipping. These are the lowest prices available for new minis anywhere... Read more
Price Drop! Clearance 14-inch M3 MacBook Pros...
Best Buy is offering a $500 discount on clearance 14″ M3 MacBook Pros on their online store this week with prices available starting at only $1099. Prices valid for online orders only, in-store... Read more
Apple AirPods Pro with USB-C on early Black F...
A couple of Apple retailers are offering $70 (28%) discounts on Apple’s AirPods Pro with USB-C (and hearing aid capabilities) this weekend. These are early AirPods Black Friday discounts if you’re... Read more
Price drop! 13-inch M3 MacBook Airs now avail...
With yesterday’s across-the-board MacBook Air upgrade to 16GB of RAM standard, Apple has dropped prices on clearance 13″ 8GB M3 MacBook Airs, Certified Refurbished, to a new low starting at only $829... Read more
Price drop! Apple 15-inch M3 MacBook Airs now...
With yesterday’s release of 15-inch M3 MacBook Airs with 16GB of RAM standard, Apple has dropped prices on clearance Certified Refurbished 15″ 8GB M3 MacBook Airs to a new low starting at only $999.... Read more
Apple has clearance 15-inch M2 MacBook Airs a...
Apple has clearance, Certified Refurbished, 15″ M2 MacBook Airs now available starting at $929 and ranging up to $410 off original MSRP. These are the cheapest 15″ MacBook Airs for sale today at... Read more
Apple drops prices on 13-inch M2 MacBook Airs...
Apple has dropped prices on 13″ M2 MacBook Airs to a new low of only $749 in their Certified Refurbished store. These are the cheapest M2-powered MacBooks for sale at Apple. Apple’s one-year warranty... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, now available for $679 for 8-Core CPU/7-Core GPU/256GB models. Apple’s one-year warranty is included, shipping is free, and each... Read more

Jobs Board

Seasonal Cashier - *Apple* Blossom Mall - J...
Seasonal Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Seasonal Fine Jewelry Commission Associate -...
…Fine Jewelry Commission Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) Read more
Seasonal Operations Associate - *Apple* Blo...
Seasonal Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Read more
Hair Stylist - *Apple* Blossom Mall - JCPen...
Hair Stylist - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom 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
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.