# A Fragment Of Your Imagination 1995 — source transcripts, page 1

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-a-fragment-of-your-imagination-1995-d7779d/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-a-fragment-of-your-imagination-1995-d7779d/1#scan-a0d95943771e7dda348cc14aaaf3bcbe073903863c5ccb5a68e7feb99f5695db)

Transcribed text:

A FRAGMENT OF YOUR IMAGINATION

Code Fragments and Code Resources for Power Macintosh® and Macintosh Programmers

Joe Zobkiw

Foreword by Scott Knaster

Includes a Special Version of Metrowerks CodeWarrior™ Compiler

Image description: A book cover with a vivid purple, pink, and orange streaked light-ray background, large orange three-dimensional block title letters with black drop shadows, and a small compact disc icon at the lower left.

Reading notes: The 'A' above 'FRAGMENT' is set separately at top left and is read as part of the title; reading order follows the stacked title lines. The surname 'Zobkiw' is printed as shown; the small disc caption is small and was read with moderate confidence.

Printed product names: Power Macintosh

Languages: English

[Original Image 1](https://www.vintageapple.net/files/331b68383bba7f8eba2f0b7affe0941cd3ec32c8193e894d96646cfee6b71ebd/63989e4dcd422d8f43745241.webp)

### PDF page 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-a-fragment-of-your-imagination-1995-d7779d/1#scan-e2448f587e022be9a65401eb6c9289e7f94a46fab9176492b9f1fc0d850bf8f0)

Transcribed text:

A FRAGMENT OF YOUR IMAGINATION

Code Fragments and Code Resources for Power Macintosh® and Macintosh Programmers

Joe Zobkiw

Foreword by Scott Knaster

Includes a Special Version of Metrowerks CodeWarrior™ Compiler

Image description: A book cover with a purple, pink, and orange rainbow-streaked background, large orange three-dimensional title lettering with black drop shadows, and a small compact disc icon in the lower left corner.

Reading notes: The small CD caption and the registered-trademark symbols are small but legible; exact symbol rendering may vary.

Languages: English

[Original PDF page 1](https://www.vintageapple.net/files/898621e13dc06d0a27dd235879e245022cbb9852eb439371da13af97ae1e704a/A_Fragment_Of_Your_Imagination_1995.pdf#page=1)

### PDF page 2

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-a-fragment-of-your-imagination-1995-d7779d/1#scan-b5129c1530530a4619aafd78e018fddf25412012913e7ebd2af2f7f8f95ec0ac)

A FRAGMENT OF YOUR IMAGINATION

Transcribed text:

A FRAGMENT   OF
YOUR   IMAGINATION
Code Fragments and
Code Resources for   Power   Macintosh®
and Macintosh Programmers
JoeZobkiw
Foreword   by   Scott   Knaster
• ~
Addison-Wesley Publishing Company
Reading, Massachusetts   •   Menlo Park, California   •   New York
Don Mills, Ontario   •   Wokingham, England   •   Amsterdam
Bonn   •   Sydney   •   Singapore   •   Tokyo   •   Madrid   •   San   Juan
Paris   •   Seoul   •   Milan   •   Mexico City   •   Taipei

Reading notes: Transcript is set to an empty string because the exact text is preserved separately. The supplied copy appears to be a book title page rather than an advertisement, so no advertised products or prices were identified. No printed dates or years appear in the supplied copy. The '~' and '•' glyphs are decorative separators and were not included in any field. The headline line break (A FRAGMENT OF / YOUR IMAGINATION) is inferred from the supplied layout and may not match the physical page exactly. Fields were filled from the supplied extracted text only, not from direct inspection of an image.

Languages: English

[Original PDF page 2](https://www.vintageapple.net/files/898621e13dc06d0a27dd235879e245022cbb9852eb439371da13af97ae1e704a/A_Fragment_Of_Your_Imagination_1995.pdf#page=2)

### PDF page 3

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-a-fragment-of-your-imagination-1995-d7779d/1#scan-07a8dd4607f28852cb20cb485cd827f89373918208e7292c5eca8e485f4232b1)

Transcribed text:

Many of the designations used by manufacturers and sellers to distinguish their
products are claimed as trademarks. Where those designations appear in this book, and
Addison-Wesley was aware of a trademark claim, the designations have been printed in
initial capital letters or all capital letters.
The author and publisher have taken care in preparation of this book, but make no
expressed or implied warranty of any kind and assume no responsibility for errors or
omissions. No liability is assumed for incidental or consequential damages in
connection with or arising out of the use of the information or programs contained
herein.
Libran1 of Congress Cataloging-in-Publication Data
Zobkiw,   Joe.
A fragment of your imagination : code fragments and code resources
for   Power   Macintosh and Macintosh programmers   I   Joe   Zobkiw.
p.   cm.
Includes bibliographical references and index.
ISBN   0-201-48358-0
1. Macintosh (Computer)-Programming.   2.   PowerPC   microprocessors-
Programming.   I.   Title.
QA76.8.M3Z63   1995
005.26-dc20   95-17045
Copyright © 1995 by Joseph M.   Zobkiw
The Tiger   Slider   used in Chapter   Seven,   "Control   Definition"   is © 1995 Tiger
Technologies.   It   was written by Robert   L.   Mathews.
CIP
The Infinity Windoid WDEF used in Chapter Eight,   "Window   Definitions," is© 1991-95
by Infinity   Systems   and Troy Gaul.
The TV Tube Photoshop filter used in Chapter Ten,   "Photoshop   Filters,"   was written by
Troy Gaul and was based on the Dissolve sample from Adobe.
The RefConLDEF is loosely based on an initial concept by Manoj Patwardhan called
LDEFl, which is© 1995 Crystal Software Inc. All rights reserved.   It   was renamed and
changed for use in this book.
All other code, unless otherwise noted, is© 1995 by Joe   Zobkiw.   All rights reserved.
All rights reserved. No part of this publication may be reproduced, stored in a retrieval
system, or transmitted, in any form or by any means, electronic, mechanical,
photocopying, recording, or otherwise, without the prior written permission of the
publisher. Printed in the   United   States   of America. Published simultaneously in Canada.
Sponsoring Editor: Martha   Steffen
Project Manager: John Fuller
Production Coordinator: Ellen   Savett
Cover Design: Chris   St.   Cyr
Set in   10   point Palatino by Clarinda
1 2 3 4 5 6 7 8 9-MA-9998979695
First   printing,   July 1995
Addison-Wesley books are available for bulk purchases   by   corporations, institutions,
and other organizations. For more information please contact the Corporate,
Government, and   Special   Sales   Department at   (800)   238-9682.

Reading notes: Library of Congress cataloging line contains OCR-like spacing and character errors (e.g., 'Libran1', 'QA76.8.M3Z63')

Printed product names: Power Macintosh · Macintosh · Tiger Slider · Infinity Windoid WDEF · TV Tube · RefConLDEF · LDEFl

Printed dates: 1995 · July 1995 · 1991-95 · 1991

Languages: English

[Original PDF page 3](https://www.vintageapple.net/files/898621e13dc06d0a27dd235879e245022cbb9852eb439371da13af97ae1e704a/A_Fragment_Of_Your_Imagination_1995.pdf#page=3)

### PDF page 4

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-a-fragment-of-your-imagination-1995-d7779d/1#scan-43708fa325785c831680ece6c448e08270f9c6d740c72da206a00c9ec04e995d)

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

[Original PDF page 4](https://www.vintageapple.net/files/898621e13dc06d0a27dd235879e245022cbb9852eb439371da13af97ae1e704a/A_Fragment_Of_Your_Imagination_1995.pdf#page=4)

### PDF page 5

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-a-fragment-of-your-imagination-1995-d7779d/1#scan-7c947f6ab2d19b205a69f74af4155c4716b5ee1215b463b19ce0b6d7425fa502)

Transcribed text:

Contents
Special Thanks
Foreword
Introduction
xv
xvii
xix
Chapter One   Introduction to Code Resources   1
Introduction   1
Anatomy of a Code Resource   2
Calling a Code Resource   2
Real-world Example of   Using   Code Resources   4
Code Resource Limitations   6
Globals in Code Resources   6
32K Limit and Multisegment Code Resources   12
Code Resource Tips   13
v

Languages: English

[Original PDF page 5](https://www.vintageapple.net/files/898621e13dc06d0a27dd235879e245022cbb9852eb439371da13af97ae1e704a/A_Fragment_Of_Your_Imagination_1995.pdf#page=5)

### PDF page 6

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-a-fragment-of-your-imagination-1995-d7779d/1#scan-ebb0d0032fd1898f223586c16d2d75f83b8d6bf555ed91c7ff7353888664bfa2)

Transcribed text:

vi   CONTENTS
Chapter Two   Power Macintosh Code Fragments   15
Introduction
The Mixed Mode Manager
Universal   Procedure   Pointers
Using   Universal   Procedure   Pointers
The Code Fragment Manager
Always Be   Prepared
Code Fragment Structure
Fragment-specific Routines
The Code Fragment Resource
Resources
Fat and Safe Fat Resources
Code Fragment and Mixed Mode Tips
Chapter Three   Application Extensions
15
16
17
23
26
27
28
30
31
32
33
34
37
Introduction   37
Private   Resources   38
Beyond   Private   Resources   39
Calling the Code   40
680x0   Code   41
PowerPC   Code   42
Code That Won't Require a Mode Switch   42
Calling   680x0   Code   43
Calling   PowerPC   Code   46
Calling Code That Won't Require a Mode Switch   47
The Resource Code   48
Other   Types of   Private   Resources   49
Working with Shared Libraries   52
Calling   Our   Shared   Library   53
Our   Shared Library Code   56
Compiling   Our   Code   58
Private   Resource Tips   59

Languages: English

[Original PDF page 6](https://www.vintageapple.net/files/898621e13dc06d0a27dd235879e245022cbb9852eb439371da13af97ae1e704a/A_Fragment_Of_Your_Imagination_1995.pdf#page=6)

### PDF page 7

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-a-fragment-of-your-imagination-1995-d7779d/1#scan-102c2b6bf37d336243da9e4a45640e6ba7b334856bb7c5f47453f22e98e2374d)

Chapter Four System Extensions

Transcribed text:

Chapter Four   System Extensions
Introduction
Anatomy of a System Extension
Introduction to MenuScript and   Patching   Traps
More MenuScript Features
MenuScript Code
Patching   Traps for   PowerPC
Inside the Patches
Compiling   Our   Code
System Extension Tips
Chapter Five   Control   Panels
Introduction
Anatomy of a Control   Panel
System Extension Changes
Control   Panel   Code
Compiling   Our   Code
Control   Panel   Tips
Chapter   Six   List Definitions
Introduction
List Definition Code
Compiling   Our   Code
Modifying the List Definition
List Definition Tips
Chapter Seven   Control Definitions
Introduction
Icon Family Control
Control Definition Code
Compiling   Our   Code
CONTENTS   vii
61
61
62
64
66
67
75
79
82
84
87
87
89
90
93
98
100
103
103
106
115
117
118
121
121
123
123
127

Reading notes: Table of contents page numbers are listed in a block without clear mapping to individual entries

Languages: English

[Original PDF page 7](https://www.vintageapple.net/files/898621e13dc06d0a27dd235879e245022cbb9852eb439371da13af97ae1e704a/A_Fragment_Of_Your_Imagination_1995.pdf#page=7)

### PDF page 8

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-a-fragment-of-your-imagination-1995-d7779d/1#scan-f173b291cb2ba8487b097b2d5595337c822a0dcd2df65bae3075f19949538bf3)

Transcribed text:

viii   CONTENTS
Modifying the Icon Family Control   128
Slider Control   129
Control Definition Code   133
Compiling   Our   Code   143
Modifying the Slider Control   145
Control Definition Tips   145
Chapter Eight   Window Definitions   147
Introduction   147
Window Definition Code   150
Main   150
New   152
Draw   152
Hit   156
CalcRegions   157
Grow and Grow Icon   158
Dispose   161
Compiling   Our   Code   161
Window Definition Tips   162
Chapter Nine   HyperCard Externals   165
Introduction   165
PowerPC Support   167
XCMD Development   168
RecordToDisk XCMD Code   169
PlayFromDisk XCMD Code   173
Compiling   Our   Code   180
HyperCard External Tips   182
Chapter Ten   Photoshop Filters   185
Introduction   185
ColorFill Filter   195
Filter Code   195

Languages: English

[Original PDF page 8](https://www.vintageapple.net/files/898621e13dc06d0a27dd235879e245022cbb9852eb439371da13af97ae1e704a/A_Fragment_Of_Your_Imagination_1995.pdf#page=8)

### PDF page 9

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-a-fragment-of-your-imagination-1995-d7779d/1#scan-1502f29482be5021c645ecfe3790b18725c2d336005028b21783f3f0c48b04cc)

Transcribed text:

Compiling   Our   Filter
TV Tube Filter
Compiling   Our   Filter
Ideas for Other Filters
Filter Tips
Chapter Eleven   Components
Introduction
Component Code
Open   Message
Close Message
Can Do Message
Version Message
Other Predefined,   Unrequired   Messages
Do Beep Message
Do Flash Message
The thng Resource
Component Tester Code
Component Tester   PowerPC   Changes
Compiling Our Code
Component Tips
CONTENTS
205
206
208
208
209
211
211
212
217
218
219
220
220
221
221
222
225
230
233
234
Chapter Twelve   Advanced and Undocumented   237
Techniques
Introduction   237
Building Fat Resources   238
Building Safe Fat Resources   239
Using   FatMan to Create Fat and Safe Fat Resources   240
Multiple Cell Formats in a List   243
Code Optimization   245
Optimize Inner Loops   245
Unroll   Loops   246
Optimize the Code that Executes the Most   246
Use   Macros Instead of Function Calls   246
ix

Reading notes: The header 'thng Resource' is likely a damaged or OCR-garbled rendering of 'The 'thng' Resource' and may be uncertain. Page numbers appear interleaved with table-of-contents entries, so reading order is uncertain. Entries such as 'Fat Resources' and 'Multiple Cell Formats in a List' lack surrounding context, making some items ambiguous.

Printed dates: 205 · 206 · 208 · 209 · 211 · 212 · 217 · 218 · 219 · 220 · 221 · 222 · 225 · 230 · 233 · 234 · 237 · 238 · 239 · 240 · 243 · 245 · 246

Languages: English

[Original PDF page 9](https://www.vintageapple.net/files/898621e13dc06d0a27dd235879e245022cbb9852eb439371da13af97ae1e704a/A_Fragment_Of_Your_Imagination_1995.pdf#page=9)

### PDF page 10

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-a-fragment-of-your-imagination-1995-d7779d/1#scan-cb55d42af1e3deb99d6ff88b55700ab49695b2e357a751b4fdb01c411bfb41d4)

Transcribed text:

x   CONTENTS
Don't Multiply or Divide   246
Optimize Last   247
Debugging Techniques   247
If   You Have to   Support   System   6   248
Sending   AppleEvents from a Code Resource   249
Writing a Daemon Application   249
Creating Stand-alones   250
Patching   Traps   251
Patching   a Register-based Trap   252
System   Extension Conflicts   253
Disabling Command-Option-Escape   253
Getting the Directory ID of the Frontmost   254
Finder Window
Creating Your   Own   AS World   255
Adding a Rightmost   System   Menu   260
GetMenu   261
MenuSelect   261
SystemMenu   261
Conclusion   261
Projects to Try on Your   Own   263
Suggested Reading   265
Magazines   265
Mac   Tech   265
develop   265
Books   266
Inside   Macintosh   266
Macintosh Programming Secrets   (Second   266
Edition)
How To Write Macintosh   Software   (Third   266
Edition)
XCMDs for HyperCard   266
PowerPC   601   RISC   Microprocessor   266
User's   Manual

Reading notes: Source appears to be a table of contents with page numbers; no advertised products, prices, or dates are visible. Some line breaks and page numbers in the extracted text may not reflect the original reading order.

Languages: English

[Original PDF page 10](https://www.vintageapple.net/files/898621e13dc06d0a27dd235879e245022cbb9852eb439371da13af97ae1e704a/A_Fragment_Of_Your_Imagination_1995.pdf#page=10)

### PDF page 11

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-a-fragment-of-your-imagination-1995-d7779d/1#scan-ec8af769923ba0b0684cda30e271134dbd0cd8e42a0bb31d3ec16786981d522e)

Transcribed text:

CONTENTS   xi
Other   267
Technical Notes   267
Online Services   267
Internet   267
Your CodeWarrior CD-ROM   267
Appendix   269
Chapter Three Source Code   269
main.c   269
main.h   276
modules.c   276
modules.h   282
globs.c   284
globs.h   284
ae.c   285
ae.h   289
dlogutils.c   289
dlogutils.h   291
init.c   292
init.h   293
prefs.c   294
prefs.h   295
utils.c   295
utils.h   296
Shared Library.c   297
Shared Library.h   299
xShell.c   299
xShell.h   300
Chapter Four Source Code   300
INIT.c   300
INIT.h   311
PPCPatches.c   311
PPCPatches.h   314
common.c   314
common.h   321

Reading notes: Source appears to be a table of contents with page numbers; no advertised products, prices, or dates are printed.

Printed product names: CodeWarrior

Languages: English

[Original PDF page 11](https://www.vintageapple.net/files/898621e13dc06d0a27dd235879e245022cbb9852eb439371da13af97ae1e704a/A_Fragment_Of_Your_Imagination_1995.pdf#page=11)

[Next transcribed scans](https://www.vintageapple.net/transcripts/media/va-a-fragment-of-your-imagination-1995-d7779d/2.md)
