# Metrowerks CodeWarrior Programming — source transcripts, page 1

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-metrowerks-code-worrior-programming-1995-973957/1)

## Transcribed source material

Machine transcriptions and image descriptions; uncertain copy may be marked [illegible]. Verify against the linked originals. Historical rights remain with the original owners.

These are transcribed excerpts, not the full publications. Open the originals for remaining pages.

### Image 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-code-worrior-programming-1995-973957/1#scan-93d3d6851f930095486bf2bbc4a5f86f2ebc771f3b25161722833700976f8386)

Transcribed text:

New Technology Building Blocks

Metrowerks CodeWarrior Programming

THE AUTHORIZED EDITION

CD-ROM INCLUDED

Includes CodeWarrior Lite

Full coverage of PowerPlant

The only authorized edition!

M&T BOOKS

Dan Parks Sydow

Image description: A book cover with bold yellow title text on dark navy and black bands, a CD-ROM badge at left, bullet points beside a red-orange photo of a handprint in sand with a small computer chip, and a yellow vertical stripe on the left edge with the M&T Books logo.

Reading notes: The small vertical text on the right edge of the cover is not legible and was not transcribed. Reading order of the bullet points and the CD-ROM badge is approximate.

Printed product names: CodeWarrior Lite · PowerPlant · CodeWarrior

Languages: English

[Original Image 1](https://www.vintageapple.net/files/9979b665a9f8d7560d333138097aa29cdb6e95443efd29adb4a00f2909e0c67a/7ece7fff0596b85b3ad15e71.webp)

### PDF page 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-code-worrior-programming-1995-973957/1#scan-cc0388300fbac52ecd290a4abe57fbafb2b0f6524c4369ae4f7374743c62fd26)

Transcribed text:

New Technology Building Blocks

Metrowerks CodeWarrior Programming

THE AUTHORIZED EDITION

CD-ROM INCLUDED

Includes CodeWarrior Lite

Full coverage of PowerPlant

The only authorized edition!

Dan Parks Sydow

M&T BOOKS

Image description: A book cover with bold yellow title text on a dark navy and black band, a yellow side stripe, a CD-ROM badge, bullet points, and a photo of a handprint in orange sand beside a small computer chip.

Reading notes: Series line 'New Technology Building Blocks' is set in small spaced italic type at the top and was transcribed as printed. Publisher logo 'M&T BOOKS' is partly stylized; spacing of the vertical spine text was read from a rotated layout.

Printed product names: CodeWarrior Lite · PowerPlant

Languages: English

[Original PDF page 1](https://www.vintageapple.net/files/b129ccb1e14e00b3b089d36b5fe3b2b219bdce197845d6a1967827a304e3d808/Metrowerks_Code_Worrior_Programming_1995.pdf#page=1)

### PDF page 2

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-code-worrior-programming-1995-973957/1#scan-a21ca37d624f150db6651cc9187b0c7de35a8913b12f78ec03e3eaec188ffe67)

Transcribed text:

metrowerks CodeWarrior

Image description: A black-and-white woodcut-style illustration of a factory interior with workers carrying stacks of floppy disks, a worker in the foreground holding a large floppy disk, a sweeping worker with a broom, and a sign reading metrowerks CodeWarrior above workers at machines, with a large clock or gear at the upper right.

Reading notes: The sign text 'metrowerks CodeWarrior' is stylized and the lowercase 'm' in metrowerks is rendered in a distinctive display style; spelling reproduced as printed. No other legible copy, prices, or dates are visible in the image.

Printed product names: metrowerks CodeWarrior

Languages: English

[Original PDF page 2](https://www.vintageapple.net/files/b129ccb1e14e00b3b089d36b5fe3b2b219bdce197845d6a1967827a304e3d808/Metrowerks_Code_Worrior_Programming_1995.pdf#page=2)

### PDF page 4 · PDF page 3

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-code-worrior-programming-1995-973957/1#scan-198e84a20cc732af6b9604eb3c712ea9755d3f281076e51ca2dadd0812716cc6)

Image description: The image is a plain, entirely blank white page with no visible artwork, layout, or text.

[Original PDF page 4](https://www.vintageapple.net/files/b129ccb1e14e00b3b089d36b5fe3b2b219bdce197845d6a1967827a304e3d808/Metrowerks_Code_Worrior_Programming_1995.pdf#page=4) · [Original PDF page 3](https://www.vintageapple.net/files/b129ccb1e14e00b3b089d36b5fe3b2b219bdce197845d6a1967827a304e3d808/Metrowerks_Code_Worrior_Programming_1995.pdf#page=3)

### PDF page 5

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-code-worrior-programming-1995-973957/1#scan-76145325d0ce8d4c1e3e51922f4c490a12cfd73519d9fea4082723a831446565)

Transcribed text:

M&T   Books
A Division of   MIS:Press,   Inc.
·A   Subsidiary of Henry Holt and Company, Inc.
115West18th   Street
Ne\Y   York, New York   10011
© 1995 by M&T Books
Printed in the   United   States   of America
All rights reserved. No part of this book may be reproduced or transmitted   in   any form
or by any means, electronic or mechanical, including photocopying, recording, or by
any information storage and retrieval system, without prior written permission from
the   Publisher.   Contact the Publisher for information on foreign rights.
Limits of Liability and Disclaimer of Warranty
The Author and Publisher of this book have used their best efforts in preparing the
book and the programs contained in it. These efforts include the development,
research, and testing of the theories and programs to determine their effectiveness.
The Author and   Publisher   make no warranty of any kind, expressed or implied, with
regard to these programs or the documentation contained in this book. The Author and
Publisher shall not be liable in any event for incidental or consequential damages in
connection with, or arising out of, the furnishing, performance, or use of these pro-
grams.
All products, names and services are trademarks or registered trademarks of their
respective companies.
ISBN:   1-55851-435-X
Editor-In-Chief:   Paul   Farrell
Managing Editor: Cary Sullivan
Development Editor: Michael   Sprague
Copy Edit Manager:   Shari   Chappell
Copy Editor:   Suzanne   Ingrao
Production Editor: Stephanie Doyle

Reading notes: Headline not identifiable in supplied copy; primary heading may be absent from extracted text

Printed dates: 1995

Languages: English

[Original PDF page 5](https://www.vintageapple.net/files/b129ccb1e14e00b3b089d36b5fe3b2b219bdce197845d6a1967827a304e3d808/Metrowerks_Code_Worrior_Programming_1995.pdf#page=5)

### PDF page 6

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-code-worrior-programming-1995-973957/1#scan-507ae786be872a4aa69ef5ce053793195d8d1884bffb2db4ec54fd7225f63c4e)

Image description: The image is a plain, entirely blank white page with no visible artwork, layout, or markings.

[Original PDF page 6](https://www.vintageapple.net/files/b129ccb1e14e00b3b089d36b5fe3b2b219bdce197845d6a1967827a304e3d808/Metrowerks_Code_Worrior_Programming_1995.pdf#page=6)

### PDF page 7

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-code-worrior-programming-1995-973957/1#scan-a05c33611c98c1b9bb6de381e01ade1022130f1c52cf7adf717488b0a5859bd6)

Table of Contents

Transcribed text:

Table   of   Contents
CHAPTER   1
Introduction   to   CodeWarrior   .................   1
Some   Terminology ........................................................................ 2
680x0, 68K,   PowerPC,   and   PPC   ............................................... 2
CodeWarrior Editions   ............................................................... 2
CodeWarrior Versions .............................................................. 4
About the CodeWarrior   CD-ROM   Package   ............................... 4
The Metrowerks C/C++   f   Folder ........................................... 5
Other   Items of Interest on the CodeWarrior CD   ................... 7
Chapter Summary ....................................................................... 10
CHAPTER   Z
CodeWarrior   Projects   ...........................   11
PPC   and 68K   Projects   .............   ; ................................................... 12
The EmptyWindow Resource File ........................................ 12
vii

Reading notes: The chapter title 'CHAPTER Z' may be an OCR misreading of 'CHAPTER 2'. Some characters in the list of contents are uncertain, such as 'PPC and 68K Projects' spacing and '; ....' fragment.

Printed product names: CodeWarrior · CodeWarrior CD-ROM · CodeWarrior CD · EmptyWindow

Languages: English

[Original PDF page 7](https://www.vintageapple.net/files/b129ccb1e14e00b3b089d36b5fe3b2b219bdce197845d6a1967827a304e3d808/Metrowerks_Code_Worrior_Programming_1995.pdf#page=7)

### PDF page 8

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-code-worrior-programming-1995-973957/1#scan-55484821517d3434110885463bd1fe1cc492d51a3e91157d05bba38475cd3f44)

Transcribed text:

viii   Metrowerks   CocleWarrior   Programming   for   the   Mac
The Empty Window MW   CIC++   68K   Project   .................... 15
The Empty Window MW C/C++   PPC   Project   ................... 21
Headers, Libraries, and the Toolbox ........................................ 24
Apple's   Universal   Header Files ............................................ 25
The   Universal   Header Files and the Toolbox ...................... 26
MacHeaders and the #include Directive   .............................. 28
Libraries and the Toolbox ...................................................... 29
The SetVolume Example   Program   ............................................   30
The SetVolume   Project   ............................................................ 32
The SetVolume Source Code   .................................................. 36
Verifying that Header Files and Libraries are Necessary .. 38
CodeWarrior   Projects   and Libraries ......................................... 41
C++   Projects   and Libraries   ..................................................... 42
ANSI   Projects   and Libraries .................................................. 43
SIOUX   Projects   and Libraries ................................................   50
Project   Stationary .................................................................... 54
Chapter Summary ....................................................................... 55
CHAPTER   3
Onderstanding   the   Oniversal
"eader   files   ..................................... 57
Errors and the   Universal   Header Files .................................... 58
The   PlaySound   Project   ............................................................ 59
The Faulty   PlaySound   Source Code ..................................... 62
Correcting the Type Mismatch Error   .................................... 63
Correcting Errors Involving the Toolbox ................................ 67

Reading notes: OCR damage in 'CocleWarrior', 'Onderstanding', 'Oniversal' and 'Universal' header line; heading and table-of-contents line structure may not reflect the original layout

Languages: English

[Original PDF page 8](https://www.vintageapple.net/files/b129ccb1e14e00b3b089d36b5fe3b2b219bdce197845d6a1967827a304e3d808/Metrowerks_Code_Worrior_Programming_1995.pdf#page=8)

### PDF page 9

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-code-worrior-programming-1995-973957/1#scan-e38013360ba8a9ca724ee73e47dd98d333fa1272298a395bad982b0f473ecff3)

Transcribed text:

Table   of   Contents
ix
The Find Dialog Box and Search Sets ................................... 68
The DelaySound Example   Program   .....................................   70
Using   the Search   Set   to Correct an Error ............................. 73
Improving the   PlaySound   Program   ......................................... 75
Using   the Search   Set ................................................................ 76
Making the Changes ............................................................... 78
Chapter Summary .....................................................................   ,   79
CHAPTER   4
Debugging   and MW   Debug   ................   81
Installing and Running MW Debug ........................................ 82
Installing the Debugger   .......................................................... 82
Installing the Debugger Nub Files   ........................................ 82
Debugger Basics   ........................................................................... 84
The ChangingValues68K   Program   ....................................... 86
MW Debug Windows ............................................................. 87
Controlling   Program   Execution ............................................ 89
Debugging the ChangingValues68K   Program   ........................ 91
Executing the ChangingValues68K   Program   ...................... 91
Variables, Data Structures, and the Debugger ........................ 95
Variables and the Locals   Pane   ............................................... 95
The Rect Data Type ................................................................. 98
The WindowPtr, WindowRecord, and
GrafPort Data Types .........................................................   100
Experimenting with the GrafPort .......................................   104
Further Investigation of the GrafPort...   ..............................   108
Chapter Summary .....................................................................   110

Reading notes: Source is a table of contents; no headline or advertised content present. Some heading lines contain stray punctuation such as ', ,' and ', 79' that may be extraction artifacts.

Languages: English

[Original PDF page 9](https://www.vintageapple.net/files/b129ccb1e14e00b3b089d36b5fe3b2b219bdce197845d6a1967827a304e3d808/Metrowerks_Code_Worrior_Programming_1995.pdf#page=9)

### PDF page 10

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-code-worrior-programming-1995-973957/1#scan-ffa6bc4ff6d93d9a8a4ebae03f526cfdcb62eeb70037b8bebdfe611f4bd437fe)

Transcribed text:

Metrowerks   CocleWarrior   Programming   for   the   Mac
x
fat   Applications   .................................. 111
Executable Code and Resources ............................................. 112
68K Applications and Code Resources ............................. 112
PowerPC Applications and Data Fork Code .................... 113
Fat Applications and Executable Code .............................. 114
Building a Fat Binary Application .......................................... 116
Creating 68K and PowerPC Applications ......................... 116
Get Ready for the Fat App ................................................... 119
Get the PPC Project Ready ................................................... 119
Build the Fat Binary Application ........................................ 123
Examining the   Programs   with a Resource Editor ............ 124
Chapter   Summary   ..................................................................... 126
Getting   Started   with   PowerPlant   .....   129
The Example Application   .........................................................   130
What the   PPintro68K   Example Does   ..................................   130
The Example   Source   Code Listing   ...................................... 132
The   PowerPlant   Project ............................................................. 133
The   PPintro68K   Example   Project   Folder ........................... 133
The   Project   and PowerPlant Classes .................................. 134
PowerPlant   Resources .............................................................. 137
The   Project   Resource File ..................................................... 138
The   PowerPlant   PPob Resource .......................................... 141

Reading notes: Source appears to be a table of contents rather than advertising copy; no headline or advertised products or prices identified.

Languages: English

[Original PDF page 10](https://www.vintageapple.net/files/b129ccb1e14e00b3b089d36b5fe3b2b219bdce197845d6a1967827a304e3d808/Metrowerks_Code_Worrior_Programming_1995.pdf#page=10)

### PDF page 11

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-code-worrior-programming-1995-973957/1#scan-9ae02c5974f17a922d8418ccaffa81ac7199bab7bf14872b896625a561394b2b)

Transcribed text:

Tabler   of   Contents   xi
PowerPlant   Classes ................................................................... 143
PowerPlant   Naming Conventions ...................................... 144
The LApplication Class ........................................................ 148
The LWindow Class .............................................................. 154
PowerPlant   Classes and Static Member Functions .......... 155
PowerPlant   Classes and the Toolbox   .................................. 157
Source Code and the   PowerPlant   Project..   ............................. 158
The #pragma once Directive and Include Files   ................. 158
The LApplication Derived Class   .........................................   160
The   CPPintroApp   Class Constructor .................................   160
What's Left? ........................................................................... 163
The   PPintroApp.h   Header File Source Code Listing ....... 164
The   PPintroApp.cp   Source Code Listing   ........................... 165
PowerPlant   and the MW   CIC++   PPC   Compiler ............ 167
Chapter Summary .................................................................... 168
CHAPTER   7
Menus   and   PowerPlant   ...................... 171
Menus, Resources, and   PowerPlant..   ...................................... 172
The   PPintro68K   Program   ..................................................... 172
Adding the   MENU   and MBAR Resources ........................ 173
Menu Items and the Mcmd Resource ................................ 174
The Mcmd Resource and Resorcerer .................................. 178
The Mcmd Resource and ResEdit..   ..................................... 184
Adding Application-Specific Menu Items ............................. 188
Command Numbers and Application Menus .................. 189
Adding Resources for a New Menu ................................... 189

Reading notes: Table of contents text contains irregular spacing and some dropped or uncertain characters (e.g., 'Tabler' likely 'Table', 'Resorcerer' likely 'Resorcerer' as printed).

Languages: English

[Original PDF page 11](https://www.vintageapple.net/files/b129ccb1e14e00b3b089d36b5fe3b2b219bdce197845d6a1967827a304e3d808/Metrowerks_Code_Worrior_Programming_1995.pdf#page=11)

### PDF page 12

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-code-worrior-programming-1995-973957/1#scan-fd26b379a9d75ade53084ad1f72f776f63d03955fb07af0d1f6e1f2b71318418)

Transcribed text:

xii   Metrowerks   CocleWarrior   Programming   for   the   Mac
Menus, Commands, and Commanders ................................. 191
Defining Menu Item Constants ........................................... 191
Menu Items, Commands, and the Target .......................... 192
Commands and the Chain of Command   ........................... 194
The Target and the LCommander Class ............................ 196
ObeyCommand() and the Chain of Command ................ 197
Overriding ObeyCommand() ..............................................   201
A Look at the ObeyCommand() Member Function .........   204
Overriding FindCommandStatus() ....................................   210
The   PPMenu68K   Example Application ................................. 214
The   PPMenu68K   Project   ....................................................... 215
The   PPMenu68K   Resources ................................................. 217
The   PPMenuApp.h   Header File Source Code Listing ..... 221
The   CPPMenuApp.cp   Source Code Listing ...................... 222
PPMenu   and the MW   CIC++   PPC   Compiler ................... 225
Adding to the   PPMenu68K   Example ..................................... 226
The   PPMoreMenu68K   Project   ............................................. 226
Adding the New Menu-Related Resources ....................... 227
Adding the New Menu-Related Source Code .................. 228
PPMoreMenu   and the MW C/C++   PPC   Compiler ......... 233
Chapter Summary .................................................................... 233
CHAPTER   8
Panes.   Constructor. and   PowerPlant   ....   235
Windows, Views, and   Panes   ................................................... 236
About   PowerPlant   Panes   ..................................................... 236
Creating   Panes   ....................................................................... 237

Reading notes: Source appears to be a table of contents rather than advertising copy; no headline or product, price, or date content is identifiable.

Languages: English

[Original PDF page 12](https://www.vintageapple.net/files/b129ccb1e14e00b3b089d36b5fe3b2b219bdce197845d6a1967827a304e3d808/Metrowerks_Code_Worrior_Programming_1995.pdf#page=12)
