ThinkC [Study Group 1] Drawing on the Macintosh

Relating to ThinkC Development

Crutch

Tinkerer
Jul 10, 2022
293
228
43
Chicago
Go to Edit —> Options —> THINK C and choose “Prefix” from the dropdown. You will see “#include <MacHeaders>” in the prefix string, so this is automatically prepended to all of your project files. (MacHeaders is the precompiled header file incorporating all of the standard Toolbox header files, including quickdraw.h)
 
  • Like
Reactions: RickLawson

MacOfAllTrades

Tinkerer
Oct 5, 2022
168
183
43
Question - so I've done a couple examples - draw HelloWorld and Mondrian. One thing I noticed is there are no imports.
Does ThinkC automatically add mac imports for you? I was expecting stuff like import "quickdraw.h" at the top of the samples?
Certain globals and functions are pulled in automatically and through the mac traps thing. Others know much more about this. But i know you do need to import certain libraries out right. Open up some of the mac libraries and you’ll see they include a lot of others so you also get a lot for free that way.
 
  • Like
Reactions: RickLawson

Crutch

Tinkerer
Jul 10, 2022
293
228
43
Chicago
MacTraps is the binary needed for routines that require “glue” code or the “[Not in ROM]” traps from Inside Mac. You will need to include this as a project file in almost every project. It includes all the Mac OS and Toolbox managers as of the System 7 era.

MacHeaders is precompiled version of headers for only the most common Toolbox/OS managers, provided to save compile time for standard apps that use these most common functions, and preincluded in the standard prefix to save you from always having to #include <QuickDraw.h> in every single project. So it doesn’t include everything. If you want to use for example the Palette Manager, its headers aren’t part of MacHeaders so you will need to #include <Palettes.h>, but you still won't have to add any more libraries because MacTraps already has you covered.
 

RickLawson

New Tinkerer
May 4, 2023
18
13
3
Boiling Springs, SC
MacTraps is the binary needed for routines that require “glue” code or the “[Not in ROM]” traps from Inside Mac. You will need to include this as a project file in almost every project. It includes all the Mac OS and Toolbox managers as of the System 7 era.

MacHeaders is precompiled version of headers for only the most common Toolbox/OS managers, provided to save compile time for standard apps that use these most common functions, and preincluded in the standard prefix to save you from always having to #include <QuickDraw.h> in every single project. So it doesn’t include everything. If you want to use for example the Palette Manager, its headers aren’t part of MacHeaders so you will need to #include <Palettes.h>, but you still won't have to add any more libraries because MacTraps already has you covered.
Great explanation - thanks!
 

RickLawson

New Tinkerer
May 4, 2023
18
13
3
Boiling Springs, SC
Ok finished up the samples. That was a hoot. Onto the next chapter!

1687351109622.png

1687351149068.png

1687351226120.png

1687351341797.png
 

RickLawson

New Tinkerer
May 4, 2023
18
13
3
Boiling Springs, SC
Also I relearned this the hard way :)

Yes, you can assign one instance of a struct to another using a simple assignment statement. In the case of non-pointer or non pointer containing struct members, assignment means copy.