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 Hat Studios unveils a new gameplay t...
There are a lot of big games coming that you might be excited about, but one of those I am most interested in is Athenian Rhapsody because it looks delightfully silly. The developers behind this project, the rather fancy-sounding Top Hat Studios,... | Read more »
Bound through time on the hunt for sneak...
Have you ever sat down and wondered what would happen if Dr Who and Sherlock Holmes went on an adventure? Well, besides probably being the best mash-up of English fiction, you'd get the Hidden Through Time series, and now Rogueside has announced... | Read more »
The secrets of Penacony might soon come...
Version 2.2 of Honkai: Star Rail is on the horizon and brings the culmination of the Penacony adventure after quite the escalation in the latest story quests. To help you through this new expansion is the introduction of two powerful new... | Read more »
The Legend of Heroes: Trails of Cold Ste...
I adore game series that have connecting lore and stories, which of course means the Legend of Heroes is very dear to me, Trails lore has been building for two decades. Excitedly, the next stage is upon us as Userjoy has announced the upcoming... | Read more »
Go from lowly lizard to wicked Wyvern in...
Do you like questing, and do you like dragons? If not then boy is this not the announcement for you, as Loongcheer Game has unveiled Quest Dragon: Idle Mobile Game. Yes, it is amazing Square Enix hasn’t sued them for copyright infringement, but... | Read more »
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 »

Price Scanner via MacPrices.net

Save $300 at Apple on 14-inch M3 MacBook Pros...
Apple has 14″ M3 MacBook Pros with 16GB of RAM, Certified Refurbished, available for $270-$300 off MSRP. Each model features a new outer case, shipping is free, and an Apple 1-year warranty is... Read more
Apple continues to offer 14-inch M3 MacBook P...
Apple has 14″ M3 MacBook Pros, Certified Refurbished, available starting at only $1359 and ranging up to $270 off MSRP. Each model features a new outer case, shipping is free, and an Apple 1-year... Read more
Apple AirPods Pro with USB-C return to all-ti...
Amazon has Apple’s AirPods Pro with USB-C in stock and on sale for $179.99 including free shipping. Their price is $70 (28%) off MSRP, and it’s currently the lowest price available for new AirPods... Read more
Apple Magic Keyboards for iPads are on sale f...
Amazon has Apple Magic Keyboards for iPads on sale today for up to $70 off MSRP, shipping included: – Magic Keyboard for 10th-generation Apple iPad: $199, save $50 – Magic Keyboard for 11″ iPad Pro/... Read more
Apple’s 13-inch M2 MacBook Airs return to rec...
Apple retailers have 13″ MacBook Airs with M2 CPUs in stock and on sale this weekend starting at only $849 in Space Gray, Silver, Starlight, and Midnight colors. These are the lowest prices currently... Read more
Best Buy is clearing out iPad Airs for up to...
In advance of next week’s probably release of new and updated iPad Airs, Best Buy has 10.9″ M1 WiFi iPad Airs on record-low sale prices for up to $200 off Apple’s MSRP, starting at $399. Sale prices... Read more
Every version of Apple Pencil is on sale toda...
Best Buy has all Apple Pencils on sale today for $79, ranging up to 39% off MSRP for some models. Sale prices for online orders only, in-store prices may vary. Order online and choose free shipping... Read more
Sunday Sale: Apple Studio Display with Standa...
Amazon has the standard-glass Apple Studio Display on sale for $300 off MSRP for a limited time. Shipping is free: – Studio Display (Standard glass): $1299.97 $300 off MSRP For the latest prices and... Read more
Apple is offering significant discounts on 16...
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
Apple HomePods on sale for $30-$50 off MSRP t...
Best Buy is offering a $30-$50 discount on Apple HomePods this weekend on their online store. The HomePod mini is on sale for $69.99, $30 off MSRP, while Best Buy has the full-size HomePod on sale... Read more

Jobs Board

*Apple* App Developer - Datrose (United Stat...
…year experiencein programming and have computer knowledge with SWIFT. Job Responsibilites: Apple App Developer is expected to support essential tasks for the RxASL 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
*Apple* Software Engineer - HP Inc. (United...
…Mobile, Windows and Mac applications. We are seeking a high energy Senior Apple mobile engineer who can lead and drive application development while also enabling Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.