← Programming C On The Macintosh 1986

Programming C On The Macintosh 1986

From the originals

13 scans

Machine-transcribed text and image descriptions. Check the linked original for uncertain words or fine print.

These are transcribed pages from the documents, not the full publications. Open the original for the remaining pages.

Image 1

PROGRAMMING C ON THE MACINTOSH Terry A. Ward

A green book cover with the large white title PROGRAMMING at top, above a blue framed panel showing a red three-dimensional grid-walled box with an orange grid floor, a large white letter C, and the white words ON THE MACINTOSH, with the author name Terry A. Ward in dark red italic script at the bottom.

Reading notes: The large letter C and the words ON THE MACINTOSH appear on the artwork and may be read as part of the cover design; the author name is in stylized italic script.

Languages
English
PDF page 1

PROGRAMMING C ON THE MACINTOSH Terry A. Ward

A book cover with a green background, large white block capital title PROGRAMMING at top, a central framed illustration of a red three-dimensional grid-lined box with an orange grid floor and a large white letter C, the words ON THE MACINTOSH below, a blue striped background, and the author name Terry A. Ward in dark red italic script at the bottom.

Reading notes: The letter C in the central illustration is rendered as a large stylized white glyph and is treated as a title element; the scan shows some light speckling on it but it is legible.

Languages
English
PDF page 2

PROGRAMMING C ON THE MACINTOSH

A mostly blank white page with a bold, three-dimensional striped title block in the upper right between two gray horizontal rules.

Reading notes: Headline letterforms are stylized with striped shading, so the reading 'PROGRAMMING C ON THE MACINTOSH' is inferred from the shapes and should be confirmed. No body text, captions, or fine print are visible apart from the title.

Languages
English
PDF page 3

PROGRAMMING C ON THE MACINTOSH

PROGRAMMING C ON THE MACINTOSH TERRY A. WARD Scott, Foresman and Company Glenview, Illinois London

A title page with large three-dimensional striped block capital lettering for the title between gray horizontal rules, the author name in bold sans-serif at right, and the publisher imprint at the bottom right, with faint body text ghosted in the background.

Reading notes: Faint background body text and table-of-contents-like lines are too washed out to transcribe reliably and were omitted. Title lettering is stylized with horizontal stripes; line breaks are as shown in the title block. Publisher imprint location names are on one line separated by space.

Languages
English
PDF page 4

ISBN 0-673-18274-6 Copyright © 1986 Scott, Foresman and Company. All Rights Reserved. Printed in the United States of America. Library of Congress Cataloging-in-Publication Data Ward, Terry A. Programming C on the Macintosh. Includes index. 1. Macintosh (Computer)-Programming. 2. C (Computer program language) I. Title. QA 76.8.M3W37 1986 005.265 85-19644 ISBN 0-673-1827 4-6 1 2 3 4 5 6-MVN-90 89 88 87 86 85 Notice of Liability The information in this book is distributed on an "As Is" basis, without warranty. Neither the author nor Scott, Foresman and Company shall have any liability to customer or any other person or entity with respect to any liability, loss, or damage caused or alleged to be caused directly or indirectly by the programs contained herein. This includes, but is not limited to, interruption of service, loss of data, loss of business or anticipatory profits, or consequential damages from the use of the programs. Trademark List Macintosh is a trademark licensed to Apple Computer, Inc. Apple, Mac, Lisa, MacPaint, MacWrite and the Mac logo are trademarks of Apple Computer, Inc. ExperLogo, ExperLISP, and ExperTelligence are trademarks of ExperTelligence, Inc. Hippo-C and Hippopotamus are trademarks of Hippopotamus Software. Mac C is a trademark of Consulair Corporation. IBM is a trademark of International Business Machines Corporation. UNIX is a trademark of Bell Laboratories. Cray is a trademark of Cray Computer Incorporated. WordStar is a trademark of MicroPro, Inc. CP /M is a trademark of Digital Research, Inc. Smalltalk-BO and Xerox 8010 Star are trademarks of Xerox Corp. DEC, VAX, and PDP-11 are trademarks of Digital Equipment Corp. UCSD Pascal is a trademark of SofTech Microsystems, Inc. VALDOCS is a trademark of Epson America. MS-DOS and Word are trademarks of Microsoft. Symphony is a trademark of Lotus, Inc. MultiMate is a trademark of MultiMate, Inc. Final Word is a trademark of Mark of the Unicorn. dBase II is a trademark of Ashton-Tate. Helix is a trademark of Odesta. R:Base 4000 is a trademark of Microrim, Inc. Bank Street Writer is a trademark of Bank Street Software. pfs:Report and pfs:File are trademarks of Software Publishing Corp. Ada is a trademark of the U.S. Department of Defense. MacModula-2 is a trademark of Modula Research Corporation.

Reading notes: Some words are split by spacing in the OCR text, such as 'Xerox 8010 Star' and 'Smalltalk-BO', which may affect exact spelling of product names

Printed product names
Macintosh · Apple · Mac · Lisa · MacPaint · MacWrite · ExperLogo · ExperLISP · ExperTelligence · Hippo-C · Hippopotamus · Mac C · IBM · UNIX · Cray · WordStar · CP /M · Smalltalk-BO · Xerox 8010 Star · DEC · VAX · PDP-11 · UCSD Pascal · VALDOCS · MS-DOS · Word · Symphony · MultiMate · Final Word · dBase II · Helix · R:Base 4000 · Bank Street Writer · pfs:Report · pfs:File · Ada · MacModula-2
Printed dates
1986
Languages
English
PDF page 5

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

Reading notes: No visible text appears anywhere on the page, so the transcript and printed fields are empty.

PDF page 6

Aeknowledgments The author and publisher would like to thank the following sources for use of their material: The program demo_graph.c (pp. 252-253) is reprinted from Brown, Wendell. Hippopotamus Software Hippo -C, Level 1, version 1.2. (Hip- popotamus Software: Sunnyvale, CA, 1984) by permission of Wendell Brown. The program rectangle.c (pp. 254-256) is based on the program click_me2.c from Brown, Wendell, Hippopotamus Software Hippo-C, Level 1, version 1.2. (Hippopotam us Software: Sunnyvale, CA, 1984) by permis- sion of Wendell Brown. The program demo_ text.c (p. 258) is reprinted from Brown, Wendell. Hippopotamus Software Hippo-C, Level 1, version 1.2. (Hippopotamus Software: Sunnyvale, CA, 1984) by permission of Wendell Brown .. The program bsweep.c and associated C header files (pp. 260 - 262) are re- printed from !\'lorgan, Jeff. Magamax C, version 1.2. (Megamax: Richardson, TX, 1984) by permission of Jeff Morgan. The program strobe.c (pp. 268-269) is reprinted from Morgan, Jeff. Megamax C, version 1.2. (Megamax: Richardson, TX,1984) by permis- sion of Jeff Morgan. The program edit. c and associated C header files (pp. 271-277) is reprinted from Morgan, J eff. M egamax C, version 1.2. (Megamax. Richardson , TX, 1984) by permission of Jeff Morgan. The program megaroids and associated data structure files (pp. 285-358) were written by Mike Bunnell and Mitch Bunnell and are reprinted from Morgan, Jeff. Megamax C, version 2.0a. (Megamax: Richardson, TX, 1984) by permission of Megamax.

Reading notes: OCR noise in heading 'Aeknowledgments' and author name 'Morgan' spelled '!\'lorgan' and 'J eff' Product name 'Hippopotamus' and 'Megamax' spacing and hyphenation inconsistent in source text

Printed product names
Hippopotamus Software Hippo-C, Level 1, version 1.2 · Megamax C, version 1.2 · Megamax C, version 2.0a
Printed dates
1984
Languages
English
PDF page 7

Preface This is a text on programming the Apple Macintosh computer using the C programming language. It can be used by readers familiar with computer programming. A brief synopsis of C is presented for readers unfamiliar with this popular programming language. A lengthy discussion of the pertinent elements of the Apple Macintosh internal software is also included. The C language was developed at Bell Laboratories and was originally designed to be run under the UNIX operating system. Increasingly, C is run under other operating systems, and it is rapidly becoming the language of choice for microcomputer programming applications. Its conciseness and power, coupled with its speed of execution, have made C a formidable contender as the standard microcomputer programming language for the next decade. Coupled with the power of the C programming language is the radical Apple Macintosh computer. Designed around a totally unique model of computing, the Macintosh provides a level of system power and integration ideally suited to advanced programming tasks. This book is designed to show how this most sophisticated of microcomputer languages can be used to unleash the incredible power of the Apple Macintosh computer. This book was written to follow the C standards as specified by Brian W. Kernighan and Dennis M. Ritchie in their book The C Pro- gramming Language (Englewood Cliffs, NJ: Prentice-Hall, 1978). The programs in this book are also designed to follow the standards

Reading notes: Excerpt ends mid-sentence at 'follow the standards' Hyphenated line breaks in source text (e.g., 'Pro-gramming') may affect reading

Printed product names
Apple Macintosh
Printed dates
1978
Languages
English
PDF page 8

x PREFACE established by Apple Computer, Inc. in their technical guide to the Macintosh internal configuration, Inside Macintosh (Apple, 1984). The text is divided conceptually into three component parts. The first presents background information on human factors engineering, the C language, and C compilers on the Macintosh. The second major division of the book discusses the nature of the Macintosh internal software structure and systematically examines the major component software elements (QuickDraw, Memory Management, event-driven software, and others). Finally, after the background and the internals have been discussed, the book concludes with a section of applications. Here, actual C programs are presented that make use of the Macintosh features and the C language to highlight the interaction of these two powerful components of software design. The text begins with a discussion of the Macintosh from the perspective of the user. Here we examine the theoretical attributes of good human engineering and see how these desired characteristics have been implemented on the Macintosh. The next chapter presents a capsule summary of the C programming language. This chapter provides sufficient detail of the language to make the remaining text understandable. A discussion then follows of the actual C compilers available on the Macintosh and the factors one can use to evaluate these competing products. Finally, concluding the presentation of background material, is a chapter devoted to a discussion of the internals of the Macintosh and how this software affects what we see on the bit-mapped Macintosh video screen. We begin the second division of the book with an examination of the very soul of the Macintosh-the QuickDraw internal software. This chapter, the longest in the book, presents a programmer's view of the Macintosh internal ROM-based software that will provide the link between our C programs, the Macintosh, and the external world. This chapter, and the others dealing with the Macintosh internal software, all follow a similar format. First, an overview of the particular software is presented. Then, complete details are provided concerning the actual routines available to the programmer. After the presentation on QuickDraw, similar presentations are made in succeeding chapters for window routines, event management, menus, and the text edit package on the Apple Macintosh. Each of these chapter-length discussions is concerned with the corresponding

Reading notes: Source is a book preface with no visible advertised products or prices; headline is not identifiable as a primary printed heading. Text is cut off mid-sentence at the end of the supplied excerpt.

Printed dates
1984
Languages
English
PDF page 9

Credits PREFACE xi Macintosh Software Manager that deals with the specified objects. Throughout these chapters, the C data structures and variable definitions used to access them are highlighted. The final part of the book is devoted to the application of what we have seen so far to the task of C programming on the Apple Macintosh. Eight C programs of increasing complexity are presented. Beginning with simple QuickDraw graphics programs, the chapter concerning simple C programs concludes with a program that could form the core of any text editing or text manipulation program that the reader might wish to construct. The intervening examples cover such topics as simple text manipulations, mathematical operations in the Macintosh environment, a standard benchmark test of program speed, and an example of how 68000 assembly language code may be interspersed with the C language to provide optimization of time-critical applica- tions. The final chapter of the book presents megaroids, a real-time, animated video game for the Macintosh. This remarkable program highlights both large-scale programming in the Macintosh environ- ment and the video capabilities of the Macintosh. The book concludes with three appendices providing supplemental information. The first provides complete listings of the C header files needed to access the Macintosh internal ROM Toolbox software. The second provides a concise, complete guide to the C programming language. The final appendix is a guide to other sources of products and software for C programming on the Macintosh. This book is just the beginning of the adventure! The author would like to thank the following people for providing the indicated C compilers used in the text: Jeff Morgan Wendell Brown William Duvall Robert Salita Megamax C Hippopotamus C Consulair Mac C and Mac C Toolkit Softworks C The author would also like to thank the following people for providing the indicated program used in the text:

Reading notes: The primary heading is not clearly identifiable; the text begins with 'Credits' and 'PREFACE' rather than a single headline. Megamax C, Hippopotamus C, Consulair Mac C and Mac C Toolkit, Softworks C, and megaroids are listed as names in running copy; 'Consulair Mac C and Mac C Toolkit' may be a single entry.

Printed product names
Megamax C · Hippopotamus C · Consulair Mac C · Mac C Toolkit · Softworks C · megaroids
Languages
English
PDF page 10

xii PREFACE Jeff Morgan edit.c, bsweep.c, strobe.c Wendell Brown rectangle.c, demo_graph.c, and demo_text.c Mike Bunnell, Mitch Bunnell, and Jeff Morgan megaroids I would also like to thank Richard K. Swadley of Scott, Foresman and Company, who actually convinced me that I could write this book in the length of time I was given. Also, I would like to thank John Duhring of the Certified Software Developer program at Apple Computer for his help in procuring an Apple Macintosh on such short order. Finally, much loving and heartfelt thanks are due my wife, Shelly, who provided me with constant encouragement throughout this project.

Languages
English
PDF page 11

Chapter 1 The Macintosh-Engineered for People

Chapter 1 The Macintosh-Engineered for People 1 Human Factors Engineering: The Human Elements 3 Human Factors Engineering: The Software Design Principles 6 The Apple Macintosh-A Case Study of Good Human Factors Engineering 9 Conclusion 17 References 18 Chapter 2 The C Language-Designed for Real Programming 19 Simplified Guide to the Syntax of C 20 Things, Things and Things-Names, Data and All That 27 Operators 31 Control Structures 36 Mobs of Data-Arrays, Structures, and Pointers 43 Guide to the Literature of C 46 Chapter 3 C Compilers on the Macintosh 49 Hippo-C 51 Megamax C 58 Consulair Mac C and Mac C Toolkit 65 Softworks C 70 Conclusions 75 Chapter 4 Macintosh Internals-Introduction 78 Overview of the Apple Internals 79 Overview of the Macintosh Internals-Operating System and Low Level Routines 83 Overview of the Macintosh Internals-Program Organization 99

Reading notes: Chapter heading line breaks and table-of-contents layout may affect reading order

Printed product names
Apple Macintosh · Macintosh · Hippo-C · Megamax C · Consulair Mac C · Mac C Toolkit · Softworks C
Languages
English