# Metrowerks CodeWarrior Programming — source transcripts, page 1

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-metrowerks-codeworrior-programming-1997-06e26c/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-codeworrior-programming-1997-06e26c/1#scan-a3ee6a9202fdd02e67861f15ebb5bfdbbe6cfbb85dc767faa50860137c9fc328)

Metrowerks CodeWarrior Programming

Transcribed text:

New Technology Building Blocks

Metrowerks
CodeWarrior
Programming

SECOND EDITION

CD-ROM INCLUDED

• Fully updated for version 10

• Includes coverage of the new Java compiler

• Try out CodeWarrior with CodeWarrior Lite—free on the CD-ROM!

CodeWarrior LITE INSIDE metrowerks

Dan Parks Sydow

M&T BOOKS

Image description: A book cover with a black and yellow title band, a red stripe reading SECOND EDITION, and a red-toned photo of a handprint in sand with a small computer chip beside it on a dark green panel.

Reading notes: The '10' in 'version 10' is a version number rather than a date and is listed only as a printed number. The 'CD-ROM INCLUDED' badge text is curved and was read from the circular seal, so its exact arrangement is approximate.

Printed product names: Metrowerks CodeWarrior Programming · CodeWarrior · CodeWarrior Lite

Printed dates: 10

Languages: English

[Original Image 1](https://www.vintageapple.net/files/1fd99bb9368ec086a432fb99c7c4d19b7ff1a060f798f0423ead4bcfc21d95e2/9e15d9d973315324f63f6014.webp)

### PDF page 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-codeworrior-programming-1997-06e26c/1#scan-370076f3e01df5ccd78b5e5ad68df4bd07a05dcc6f7a45b17b7a7a765bdf266a)

Metrowerks CodeWarrior Programming

Transcribed text:

New Technology Building Blocks

Metrowerks
CodeWarrior
Programming

SECOND EDITION

CD-ROM INCLUDED

• Fully updated for version 10

• Includes coverage of the new Java compiler

• Try out CodeWarrior with CodeWarrior Lite—free on the CD-ROM!

CodeWarrior LITE INSIDE metrowerks

M&T BOOKS

Dan Parks Sydow

Image description: A book cover with large yellow title text on black and red bands, a red hand print in sand with a small chip image on the right, and a yellow-orange gradient strip with a CD-ROM badge on the left.

Reading notes: The 'New Technology Building Blocks' series line at top is small and italicized, so spacing may be approximate. The M&T Books logo text is small and partly stylized; 'BOOKS' is read vertically.

Printed product names: Metrowerks CodeWarrior Programming · CodeWarrior Lite

Printed dates: version 10

Languages: English

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

### PDF page 2

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-codeworrior-programming-1997-06e26c/1#scan-6ac5e46b133e5ed75774f8d9d93fbb18e46de4475b6443973eacce6420a12efb)

Metrowerks CodeWarrior Programming

Transcribed text:

Metrowerks
CodeWarrior
Programming
Second Edition
Dan Parks Sydow
M&T BOOKS

Image description: A book title page with a black-and-white engraving of a man in work clothes carrying a large floppy-disk-like object at top right, with bold stacked title text centered below, and the M&T Books logo at the bottom center.

Reading notes: Faint background text and ghosted fine print behind the title (apparently from the reverse or a scanned overlay) is largely illegible and was not transcribed. Small text at the top right edge and faint lines near the title block are not legible enough to transcribe. The M&T BOOKS logo text is partially stylized; 'BOOKS' is read vertically along the right side.

Printed product names: Metrowerks CodeWarrior

Languages: English

[Original PDF page 2](https://www.vintageapple.net/files/1aafcb49c1a707bb4f83d134bfe388b41e9518755e8bc8d50adbd5ba6cf98d4f/Metrowerks_CodeWorrior_Programming_1997.pdf#page=2)

### PDF page 3

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-codeworrior-programming-1997-06e26c/1#scan-fe078e5a2d9c196e2649b5a81c509f47b38c1573e14c169af708275efa3690a6)

Transcribed text:

M&T Books
A Division of   MIS:Press,   Inc.
A Subsidiary of Henry Holt and Company, Inc.
115West18th   Street
New York, New York   10011
http:/ /www.mispress.com
Copyright© 1997 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   Pub-
lisher. 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,   researcfi.,   and test-
ing 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 con-
nection with, or arising out of, the furnishing, performance, or use of these programs.
All products, names and services are trademarks or registered trademarks of their respec-
tive companies.
First Edition-1997
Library of Congress Cataloging-in-Publication Data
p.   cm.
ISBN   1-55851-505-4
MIS:Press   and M&T Books are available at special discounts for bulk purchases for sales
promotions, premiums, and fundraising.   Special   editions or book excerpts can also be
created to specification.
For details contact:
10   9 8 7 6 5 4 3 2 1
Special   Sales   Director
MIS:Press   and M&T Books
Subsidiaries of Henry Holt and Company, Inc.
115West18th   Street
New York, New York   10011
Associate   Publisher:   Paul   Farrell
Executive Editor:   Cary Sullivan
Editor:   Michael Sprague
Copy Edit Manager:   Shari Chappell
Production   Editor:   Patricia Wallenburg
Copy Editor:   Suzanne Ingrao

Reading notes: Headline not clearly identifiable; source is a copyright/front-matter page with no primary heading. Printed date '1997' appears in both the copyright line and the First Edition line.

Printed dates: 1997

Languages: English

[Original PDF page 3](https://www.vintageapple.net/files/1aafcb49c1a707bb4f83d134bfe388b41e9518755e8bc8d50adbd5ba6cf98d4f/Metrowerks_CodeWorrior_Programming_1997.pdf#page=3)

### PDF page 4

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-codeworrior-programming-1997-06e26c/1#scan-297edbd4cc34fc13f4483c56d73750e5474d54cfb2e0e0b83629321de62f1c03)

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

Reading notes: The image appears to be a blank white page with no visible text, so the transcript and printed fields are empty.

[Original PDF page 4](https://www.vintageapple.net/files/1aafcb49c1a707bb4f83d134bfe388b41e9518755e8bc8d50adbd5ba6cf98d4f/Metrowerks_CodeWorrior_Programming_1997.pdf#page=4)

### PDF page 5

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-codeworrior-programming-1997-06e26c/1#scan-27dcb6ed5dd7a0ba3bf3b1f7500bf076403577b7d18afd62f521c11f16405abe)

Transcribed text:

Acknowledgments
Michael Sprague, Editor, M&T Books, for keeping things rolling along.
Patty   Wallenburg,   Production   Editor, for a page layout effort that
resulted in such a polished looking book.
The many Metrowerks people who were so readily accessible and
quick to provide information. Among those at Metrowerks who
answered questions or provided input:
Greg   Galanos,   President;   Jim   Trudeau,   CodeWarrior
Documentation; Ron Liechty, Middleman Extrordinaire; Joshua Golub,
ZoneRanger; Eric Scouten, Constructor; Greg Dow,   PowerPlant;   Steve
Nicolai,   Profiler;   and Greg Combs, CD Burnmeister.
Carole McClendon, Waterside   Productions,   for making this book
happen.
Mike E. Floyd, for permission to use his Blue Angels picture in
Chapter 12.

Reading notes: Irregular spacing in some lines may reflect layout justification rather than original text

Languages: English

[Original PDF page 5](https://www.vintageapple.net/files/1aafcb49c1a707bb4f83d134bfe388b41e9518755e8bc8d50adbd5ba6cf98d4f/Metrowerks_CodeWorrior_Programming_1997.pdf#page=5)

### PDF page 6

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-codeworrior-programming-1997-06e26c/1#scan-3c76f2ada8063f58b77deae0c28f6c9de2a626a85a60b4f4b06bc8d5c01752bb)

Table of Contents

Transcribed text:

Table
of
Contents
Introduction   x
About the CD-ROM ... .. .... .................... . . . . ..... xviii
About This Book ............... .... ...... ... .............. xix
Chapter   1:   lntrodaction   to   CodeWarrior   1
Some   Terminology .. ...................................... . . 2
Metrowerks and the CodeWarrior IDE .. ...... ............. 2
CodeWarrior Editions and Versions ........... ............. 2
680x0, 68K, PowerPC, and PPC . . .... ... .. .. . .. . .... .. .. ... 5
Native Code, Emulation, and Fat Applications   . . .... . ....... 5
Aboutthe CodeWarrior CD-ROM Package .. . .... .............. 8
The Metrowerks CodeWarrior Folder ......... ............   10
The Metrowerks PowerPlant Folder ..... . ..... ... . ........ 11
The   Other   Metrowerks Tools Folder ....... . ... ........... 13

Reading notes: OCR-style spacing and possible misreading of 'lntrodaction' (likely 'Introduction') and 'Aboutthe' in the table of contents

Printed product names: CodeWarrior · CodeWarrior IDE · PowerPlant

Languages: English

[Original PDF page 6](https://www.vintageapple.net/files/1aafcb49c1a707bb4f83d134bfe388b41e9518755e8bc8d50adbd5ba6cf98d4f/Metrowerks_CodeWorrior_Programming_1997.pdf#page=6)

### PDF page 7

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-codeworrior-programming-1997-06e26c/1#scan-59b0125382b7836ff788da62f5d909a3951d27bd1bad93e1d076c8ef35a575d7)

Transcribed text:

viii   Metrowerks   CodeWarrlor   Programming.   Second   Edition
Other   Items of Interest on the CodeWarrior CDs ............ 14
Chapter Summary ......................................... 15
Chapter   Z:   CocleWarrior   Projecb   17
Introduction to   Projects   ..................................... 18
Creating a New   Project   Using   Project   Stationery ............ 18
Compiling and Running the Project's Code ................ 26
What's Missing? ....................................... 29
Creating an Application .................................... 29
Creating a New   Project   ..................................   30
Creating and Adding a Resource File to a   Project   ........... 32
Creating and Adding a Source Code File to a   Project   ........ 42
Specifying which Compiler CodeWarrior Should   Use   ....... 46
Compiling and Running the Project's Code ................ 47
Supplying a New Name for the Application ............... 49
Examining the Results of Your Efforts ..................... 51
Other   CodeWarrior   Project   Types ............................ 52
Console   Projects   ........................................ 52
C   ++   Projects   ........................................... 55
Chapter Summary ......................................... 57
Chapter   J:   Understanding   the   Universal   Interface   Fila   59
Header Files and the Toolbox ...............................   60
Apple's Universal Interface Header Files ..................   60
Universal Interface Header Files and Your Code ............ 62
MacHeaders and the #include Directive ................... 67
The SpeakPhrase Example   Program   .......................... 68
The SetVolume   Project   .................................. 68
The SpeakPhrase Source Code ...........................   70
Verifying that Header Files and Libraries are Necessary ..... 71

Reading notes: Table of contents text with OCR-like spacing artifacts; page numbers and dotted leaders may be imprecise

Printed product names: CodeWarrior · Project Stationery · Universal Interface · MacHeaders · SpeakPhrase · SetVolume

Languages: English

[Original PDF page 7](https://www.vintageapple.net/files/1aafcb49c1a707bb4f83d134bfe388b41e9518755e8bc8d50adbd5ba6cf98d4f/Metrowerks_CodeWorrior_Programming_1997.pdf#page=7)

### PDF page 8

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-codeworrior-programming-1997-06e26c/1#scan-4576119ae79d33b591941ccb30bedd21f1f7c54da127a1083af69ad861d14bc1)

Transcribed text:

Table   of   Contents
ix
Errors and the   Universal   Header Files ........................ 74
The   PlaySound   Project   .................................. 75
The Faulty   PlaySound   Source Code ....................... 78
Correcting the Type Mismatch Error ......................   80
Searching   the   Universal   Interface Files ....................... 86
The Find Dialog Box and Search   Sets   ...................... 87
The DelaySound Example   Program   .......................   90
Using   the Search   Set   to Correct an Error ................... 93
Chapter Summary ......................................... 96
Chapter   4: Debugging and MW Debug   99
Debugger Basics ..........................................   100
Installing the Debugger ................................   100
Enabling the Debugger for a   Project   ......................   101
MW Debug Windows ..................................   102
Controlling   Program   Execution .........................   106
Debugging an Example   Program   ...........................   108
The ChangingValues68K   Program   .......................   108
Executing ChangingValues68K without MW Debug ........   110
Executing ChangingValues68K with MW Debug ........... 111
Variables, Data Structures, and the Debugger ................. 115
Variables and the Variables   Pane   ........................ 116
The Rect Data Type ....................................   120
The WindowPtr, WindowRecord, and GrafPort Data Types   . 122
Experimenting with the GrafPort ........................ 126
Further Investigation of the GrafPort .....................   130
Chapter Summary ........................................ 133
Chapter   5: fat   Applications   135
Executable Code and Resources ............................ 136

Reading notes: Source is a table of contents excerpt with no advertised products, prices, or dates. Some chapter titles appear damaged, including 'Chapter 5: fat Applications' and 'MW Debug'.

Languages: English

[Original PDF page 8](https://www.vintageapple.net/files/1aafcb49c1a707bb4f83d134bfe388b41e9518755e8bc8d50adbd5ba6cf98d4f/Metrowerks_CodeWorrior_Programming_1997.pdf#page=8)

### PDF page 9

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-codeworrior-programming-1997-06e26c/1#scan-b337d7f7913840dabe415407e28e8b56d9680f02f675e61a294fa07664461bd7)

Transcribed text:

Metrowerks   CodeWarrlor   Programming.   Second   Edition
x
68K Applications and Code Resources ................... 136
PowerPC   Applications and Data Fork Code ............... 137
Fat Applications and Executable Code ................... 138
Building a Fat Binary Application ........................... 139
Creating 68K and   Power PC   Projects .....................   140
Using   a   Single   Source   Code File for Both Projects .......... 142
Building the Applications .............................. 144
Creating the Fat Application Project ..................... 145
Creating the Fat Application ............................ 147
Examining the Programs with a Resource Editor .......... 149
Summary   ................................................ 152
Chapter   6:   Java.   Applets.   and   the   World   Wide   Web   155
Web Browsers, Applets, and the Web ........................ 156
About Web Browsers .................................. 156
Applets and Platform Independence ..................... 158
Java Interpreters and Bytecode ..........................   160
The Java Applet Project .................................... 162
Creating a Java Applet Project .......................... 163
The Files in a Java Project ............................... 164
Running the Default Applet ............................ 169
HTML and Applets ....................................... 174
The <applet> Tag ...................................... 174
Applets and Web Browsers ............................. 176
Java   Source   Code and the TrivialApplet ..................... 178
Import   Statements   ..................................... 178
The Applet Class ...................................... 179
Methods .............................................   180
Summary   ................................................ 181

Reading notes: OCR reads 'CodeWarrlor' in the running header, likely a misreading of 'CodeWarrior'

Languages: English

[Original PDF page 9](https://www.vintageapple.net/files/1aafcb49c1a707bb4f83d134bfe388b41e9518755e8bc8d50adbd5ba6cf98d4f/Metrowerks_CodeWorrior_Programming_1997.pdf#page=9)

### PDF page 10

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-codeworrior-programming-1997-06e26c/1#scan-5ba5b2846aca23ce7ae9866081546e9210bbf754723798591aab4d3beb3d77c5)

Chapter 7: Getting Started with PowerPlant and Constructor

Transcribed text:

Chapter   7:   Getting   Started   with
PowerPlant   and   Constructor
Table   of   Contents
183
The   PowerPlant   Project   .................................... 184
What the Example   PowerPlant   Application Does .......... 185
Creating a   PowerPlant   Project   ........................... 188
PowerPlant   Projects   and   PowerPlant   Classes ..............   190
Running the Default   Program   ........................... 192
PowerPlant   Resource Files ................................. 194
The   PP   Basic Resource.rsrc File .......................... 195
The   PP   Action Strings.rsrc File .......................... 199
The   PP   DebugAlerts.rsrc File ............................   200
The   PP   Basic Resource.ppob File ........................   201
Constructor and   PowerPlant   Resources ......................   201
Constructor-The Resource Editor .......................   202
The   PPob   Resource Type ...............................   207
Other   Resource Types .................................. 217
Summary   ................................................ 219
Chapter   8:   PowerPlant   Classes   221
PowerPlant   Classes ....................................... 222
PowerPlant   Naming Conventions .......................... 224
Class Names .......................................... 225
Variable Names ....................................... 226
Data Type Names ..................................... 226
Constant Names ...................................... 226
Function   Parameter   Names ............................. 227
Select   PowerPlant   Classes ................................. 228
The LApplication Class ................................ 228
The LWindow Class ................................... 236
xi

Reading notes: Table of contents page numbers and some heading spacing appear irregular in the extracted text.

Printed product names: PowerPlant · Constructor

Languages: English

[Original PDF page 10](https://www.vintageapple.net/files/1aafcb49c1a707bb4f83d134bfe388b41e9518755e8bc8d50adbd5ba6cf98d4f/Metrowerks_CodeWorrior_Programming_1997.pdf#page=10)

### PDF page 11

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-metrowerks-codeworrior-programming-1997-06e26c/1#scan-ff842d74ea3cc5020eb0508fe4687dd361dce4d46a1713a88ebe5555e64d7d38)

Transcribed text:

xii   Metrowerks   CocleWarrior   Programming,   Second   Edition
PowerPlant Classes and   Static   Member Functions ......... 237
PowerPlant Classes and the Toolbox ..................... 238
The   PP   Basic   Starter   Source   Code ...........................   240
The main() Function ...................................   240
The LApplication Derived Class ......................... 242
What's Left? .......................................... 245
Summary   ................................................ 245
Chapter   9:   PowerPlant   and   Menus   247
Menu Resources and PowerPlant ........................... 248
The PowerPlantlntro68K Program ....................... 248
MENU and MBAR Resources ........................... 249
Menu Items and the Mcmd Resource ..................... 251
Menus, Commands, and Commanders ...................... 256
Menu Items, Commands, and the Target .................. 256
Commands and the Chain of Command .................. 257
The Target and the LCommander Class .................. 262
Handling Menu Selections ................................. 263
ObeyCommand() and the Chain of Command ............ 264
Overriding ObeyCommand() ........................... 267
A Look at the ObeyCommand() Member Function ......... 271
Overriding FindCommandStatus() ...................... 277
Adding Application-Specific Menu Items .................... 279
Command Numbers and Application Menus .............   280
Adding Resources for a New Menu ......................   280
Defining Menu Item Constants ..........................   280
Writing the ObeyCommand() Function ................... 281
Writing the FindCommandStatus() Function .............. 283
The PowerPlantMenu68K Example Application .............. 284
The PowerPlantMenu68K Project ........................ 285
The PowerPlantMenu68K Resources ..................... 285

Reading notes: Source text appears to be a table of contents with hyphenated or spaced words in places; reading order is list-like rather than narrative.

Languages: English

[Original PDF page 11](https://www.vintageapple.net/files/1aafcb49c1a707bb4f83d134bfe388b41e9518755e8bc8d50adbd5ba6cf98d4f/Metrowerks_CodeWorrior_Programming_1997.pdf#page=11)

[Next transcribed scans](https://www.vintageapple.net/transcripts/media/va-metrowerks-codeworrior-programming-1997-06e26c/2.md)
