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

Aether Gazer unveils Chapter 16 of its m...
After a bit of maintenance, Aether Gazer has released Chapter 16 of its main storyline, titled Night Parade of the Beasts. This big update brings a new character, a special outfit, some special limited-time events, and, of course, an engaging... | Read more »
Challenge those pesky wyverns to a dance...
After recently having you do battle against your foes by wildly flailing Hello Kitty and friends at them, GungHo Online has whipped out another surprising collaboration for Puzzle & Dragons. It is now time to beat your opponents by cha-cha... | Read more »
Pack a magnifying glass and practice you...
Somehow it has already been a year since Torchlight: Infinite launched, and XD Games is celebrating by blending in what sounds like a truly fantastic new update. Fans of Cthulhu rejoice, as Whispering Mist brings some horror elements, and tests... | Read more »
Summon your guild and prepare for war in...
Netmarble is making some pretty big moves with their latest update for Seven Knights Idle Adventure, with a bunch of interesting additions. Two new heroes enter the battle, there are events and bosses abound, and perhaps most interesting, a huge... | Read more »
Make the passage of time your plaything...
While some of us are still waiting for a chance to get our hands on Ash Prime - yes, don’t remind me I could currently buy him this month I’m barely hanging on - Digital Extremes has announced its next anticipated Prime Form for Warframe. Starting... | Read more »
If you can find it and fit through the d...
The holy trinity of amazing company names have come together, to release their equally amazing and adorable mobile game, Hamster Inn. Published by HyperBeard Games, and co-developed by Mum Not Proud and Little Sasquatch Studios, it's time to... | Read more »
Amikin Survival opens for pre-orders on...
Join me on the wonderful trip down the inspiration rabbit hole; much as Palworld seemingly “borrowed” many aspects from the hit Pokemon franchise, it is time for the heavily armed animal survival to also spawn some illegitimate children as Helio... | Read more »
PUBG Mobile teams up with global phenome...
Since launching in 2019, SpyxFamily has exploded to damn near catastrophic popularity, so it was only a matter of time before a mobile game snapped up a collaboration. Enter PUBG Mobile. Until May 12th, players will be able to collect a host of... | Read more »
Embark into the frozen tundra of certain...
Chucklefish, developers of hit action-adventure sandbox game Starbound and owner of one of the cutest logos in gaming, has released their roguelike deck-builder Wildfrost. Created alongside developers Gaziter and Deadpan Games, Wildfrost will... | Read more »
MoreFun Studios has announced Season 4,...
Tension has escalated in the ever-volatile world of Arena Breakout, as your old pal Randall Fisher and bosses Fred and Perrero continue to lob insults and explosives at each other, bringing us to a new phase of warfare. Season 4, Into The Fog of... | Read more »

Price Scanner via MacPrices.net

New today at Apple: Series 9 Watches availabl...
Apple is now offering Certified Refurbished Apple Watch Series 9 models on their online store for up to $80 off MSRP, starting at $339. Each Watch includes Apple’s standard one-year warranty, a new... Read more
The latest Apple iPhone deals from wireless c...
We’ve updated our iPhone Price Tracker with the latest carrier deals on Apple’s iPhone 15 family of smartphones as well as previous models including the iPhone 14, 13, 12, 11, and SE. Use our price... Read more
Boost Mobile will sell you an iPhone 11 for $...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering an iPhone 11 for $149.99 when purchased with their $40 Unlimited service plan (12GB of premium data). No trade-in is required... Read more
Free iPhone 15 plus Unlimited service for $60...
Boost Infinite, part of MVNO Boost Mobile using AT&T and T-Mobile’s networks, is offering a free 128GB iPhone 15 for $60 per month including their Unlimited service plan (30GB of premium data).... Read more
$300 off any new iPhone with service at Red P...
Red Pocket Mobile has new Apple iPhones on sale for $300 off MSRP when you switch and open up a new line of service. Red Pocket Mobile is a nationwide MVNO using all the major wireless carrier... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, available for $759 for 8-Core CPU/7-Core GPU/256GB models and $929 for 8-Core CPU/8-Core GPU/512GB models. Apple’s one-year warranty is... Read more
Updated Apple MacBook Price Trackers
Our Apple award-winning MacBook Price Trackers are continually updated with the latest information on prices, bundles, and availability for 16″ and 14″ MacBook Pros along with 13″ and 15″ MacBook... Read more
Every model of Apple’s 13-inch M3 MacBook Air...
Best Buy has Apple 13″ MacBook Airs with M3 CPUs in stock and on sale today for $100 off MSRP. Prices start at $999. Their prices are the lowest currently available for new 13″ M3 MacBook Airs among... Read more
Sunday Sale: Apple iPad Magic Keyboards for 1...
Walmart has Apple Magic Keyboards for 12.9″ iPad Pros, in Black, on sale for $150 off MSRP on their online store. Sale price for online orders only, in-store price may vary. Order online and choose... Read more
Apple Watch Ultra 2 now available at Apple fo...
Apple has, for the first time, begun offering Certified Refurbished Apple Watch Ultra 2 models in their online store for $679, or $120 off MSRP. Each Watch includes Apple’s standard one-year warranty... Read more

Jobs Board

DMR Technician - *Apple* /iOS Systems - Haml...
…relevant point-of-need technology self-help aids are available as appropriate. ** Apple Systems Administration** **:** Develops solutions for supporting, deploying, 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
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
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
IT Systems Engineer ( *Apple* Platforms) - S...
IT Systems Engineer ( Apple Platforms) at SpaceX Hawthorne, CA SpaceX was founded under the belief that a future where humanity is out exploring the stars is Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.