← Advanced Macintosh Pascal 1986

Advanced Macintosh Pascal 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

HAYDEN Macintosh Library BOOKS 046570 Advanced Macintosh Pascal Powering Up with Files, QuickDraw, the Toolbox, and InLines Paul Goodman

A blue-to-purple gradient book cover with a red top band, a framed illustration of a beige Macintosh computer with keyboard and mouse emerging between two wood-grain panels against a cloudy sky, and yellow wavy lines flanking the image.

Reading notes: The top band text 'HAYDEN' and 'BOOKS' are small italic/stylized print; 'Macintosh Library' is in yellow script and was transcribed as printed. The number 046570 appears on a blue sticker and is transcribed as printed. The subtitle is in italic serif and is transcribed as shown.

Printed product names
Macintosh
Languages
English
PDF page 1

HAYDEN Macintosh Library BOOKS 046570 Advanced™ Macintosh Pascal Powering Up with Files, QuickDraw, the Toolbox, and InLines Paul Goodman

A blue-to-purple book cover with a red top band, a framed illustration of a beige Macintosh computer with keyboard and mouse set against a cloudy sky between cut-away wooden panels, and a yellow wavy line across the middle.

Reading notes: The small sticker code 046570 in the upper right is partially on a light blue patch and may be a library or stock number; its exact reading is clear but its purpose is uncertain. The 'Macintosh Library' script logo in the top band is stylized and read as printed; spacing is approximate. Subtitle line is italic and small; letters such as 'h' and 'w' in the italic serif are stylized and may be read with minor variance.

Printed product names
Macintosh
Languages
English
PDF page 2

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

PDF page 3

Advanced Macintosli Pascal Paul Goodman HAYDEN BOOKS A Division of Howard W. Sams & Company 4300 West 62nd Street Indianapolis, Indiana 46268 USA

Reading notes: Headline spelled 'Macintosli' in source text; reading as 'Macintosh' is uncertain

Languages
English
PDF page 4

© 1987 by Hayden Books A Division of Howard W. Sams & Co. FIRST EDITION FIRST PRINTING-1986 All rights reserved. No part of this book shall be reproduced, stared in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. While every precaution has been taken in the preparation of this book, the publisher assumes no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained herein. International Standard Book Number: 0-672-6570-1 Library of Congress Catalog Card Number: 86-63300 Acquisitions Editor: Bill Grout Editor: Ronnie Groff Cover Design: Jim Bernard Cover Photo: Lou Odor Composition and Production: Publishers Network Printed in the United States of America

Reading notes: Word 'stared' in copyright notice appears to be a typographical error for 'stored'

Printed dates
1987 · 1986
Languages
English
PDF page 5

Contents Chapter 1 Chapter 2 Chapter 3 v Introduction Macintosh System and Memory Overview Macintosh Overview Macintosh Pascal Memory Advanced Pascal Structures Records The With Statement Variant Records Sets Set Operations 24 SetUnion 24 Set Intersection Set Difference Set Comparisons 24 24 Pointers Files and File Programming File Concepts The File Data Type 35 Using Sequential Files Opening a Sequential File 37 Closing a File 38 ix 1 2 4 5 13 14 16 18 22 23 33 33 36 ·,

Reading notes: Page number fragment '·,' at end of source is unclear

Languages
English
PDF page 6

Chapter4 Chapter 5 Chapter 6 Vi Advanced Macintosh Pascal Reading Data 39 Erasing a Sequential File 40 File Processing with Sequential Files Random Files Opening a Random File 41 Writing and Reading Data 42 Working with Random Files 42 Finding the End of a File The Haiku Writer Indexed Sequential Access Method Events Why Use Events? Event Types Event Records Keyboard Events Using Bits Masks Using Events Programming with GetNextEvent EventAvail Flush Events 40 QuickDraw Programming Techniques The GridEdit Program Drawing Other Shapes Ovals 82 Round-Cornered Rectangles Simple Animation Techniques The PaulPaint Program PaulPaint Revisited Text-Drawing Routines The Three-Card Monte Program Simulating Pushbuttons Radio Buttons The InLine Routines-Accessing the Toolbox Menus Windows More on FindWindow 128 Programming Example-Windows and Menus 41 43 47 52 59 59 60 62 64 65 68 70 72 74 77 78 82 83 84 87 91 94 95 97 105 1:: I :111 I 11 ;1 I ' 1 [1 I I i I I ! I I

Reading notes: Table of contents layout and page numbers may have uncertain reading order

Languages
English
PDF page 7

Chapter 7 Chapter 8 Vii Contents Programmer Defined Windows Miscellaneous Window Routines The Controls Manager Other Control Routines Text Editing Text Editing Summary SHIFT Click 184 Building the Strings 185 Input Verification 185 Other Text Edit Routines 187 137 140 140 152 153 154 The Haiku Writer Revisited 168 Some Final Notes on Using InLines Advanced QuickDraw GraiPorts More on Drawing Text Determining Text Widths 195 Pen Characteristics Pen Location 198 Pen Pattern 197 PenMode 197 Line Drawing Routines Complex Drawing Shapes Drawing a Region 204 Disposing a Region 205 Calculations with Regions Using Regions Polygons Manipulating Polygons 218 Defining Custom Patterns Cursors Pictures Calculations with Points Drawing in Color Additional Routines A Complete Application: The Logger 188 191 191 193 198 201 201 205 210 212 217 224 226 230 231 232 235

Reading notes: Table of contents page numbers and some heading spacing are irregularly extracted, so chapter and section ordering may be imprecise. Some entries show OCR-like character damage such as 'Vii' for 'Vii' or 'SHIFT Click' lacking a clear section number.

Languages
English
PDF page 8

Chapter 9 Appendix A AppendixB AppendixC • Index Viii Advanced Macintosh Pascal The Standard Apple Numerical Environment (SANE) .259 Data Types Arithmetic Operations Selecting a Data Type 264 Mathematical Functions Logarithm Functions 266 Exponential Functions 266 Financial Functions 267 Random Number Generation Macintosh Pascal Version .2.0 The Application Shell Changes to Files and Devices Procedural Parameters Resources Memory Management Other Changes Program Size 273 Error Handling 273 Relaxed Order of Declarations User Interface Changes 273 Toolbox Quick Reference Menu Manager Window Manager Controls Text Editing 267 273 Decimal· Binary - Hexadecimal Chart 260 263 265 269 269 270 271 272 272 273 275 275 276 276 277 .279 281 1.··.,. I I' ,, i'j, "' I I.

Reading notes: Source appears to be a table of contents fragment with page numbers and possible OCR noise; reading order is uncertain. Some characters such as 'Viii' and 'AppendixB' may be OCR errors.

Languages
English
PDF page 9

Introduction The Macintosh with its sophisticated concepts and its rich repertoire of routines built into ROM presents an exciting programming environment to use and explore. Unfortunately, the would-be explorer has had trouble find- ing a suitable programming language to work with. Certainly, most program- mers have outgrown BASIC, and the C language implementations for the Macintosh have been complex, tedious to use, and expensive. Many program- mers have felt that they had a home with Macintosh Pascal, albeit a home without the amenities one might hope for. Advanced Macintosh Pascal was written for those who wish to break down the walls of that house and explore the full meaning and depth of the Macintosh. The reader of this book will already have some mastery of the Pascal language and will want to learn how to use its more advanced features or may just want to "get into the ROM." The approach of this book is broad enough for both. The book's goals can be summarized as follows: • To explore the Macintosh memory and memory management techniques • To increase the reader's knowledge of Pascal structures and skills as a programmer • To teach data file programming • To introduce the reader to the Macintosh User Interface Toolbox and QuickDraw and explain their procedures and functions • To show the reader how to use Macintosh Pascal to develop "real" Macin- tosh applications that implement windows, menus, controls and text edit- ing. ix

Reading notes: Source text contains irregular spacing and hyphenation within words such as 'find-ing' and 'Macin-tosh', which may reflect line-break artifacts rather than intended spelling.

Printed product names
Macintosh · Macintosh Pascal · Advanced Macintosh Pascal · BASIC · C · Macintosh User Interface Toolbox · QuickDraw
Languages
English
PDF page 10

X Advanced Macintosh Pascal Macintosh Pascal represents a significant advance in programming lan- guage systems. As a programming language, Macintosh Pascal is a full imple- mentation of the ANSI Pascal standards. Add to this full IEEE numeric standards for accuracy and you have a Pascal system suitable for either scientific or business applications. As a programming environment, Macintosh Pascal combines the power of Pascal programming with the ease of using BASIC. Implemented via an inter- preter rather than a compiler, Macintosh Pascal significantly cuts program development time by eliminating long waits for compilation. Sophisticated debugging tools also reduce development time. However, because of the speed of the Macintosh, Macintosh Pascal does not suffer from the slow execution times of other interpreted languages. As a way to explore the Macintosh, Macintosh Pascal provides a safe, easy environment to work with. Full access to the Macintosh's QuickDraw graphics package is provided via built-in routines with full Pascal-type checking. This means no fatal systems crashes will occur if you make a programming mistake using QuickDraw. Partial access is provided to the Macintosh's Toolbox, which controls the operation of the mouse and the other unique Macintosh features. Access to the remaining Toolbox routines is provided via the unprotected Inline procedures. The only problem that programmers have faced with Macintosh Pascal has been finding information on both advanced Pascal concepts and the Macintosh itself. Advanced Macintosh Pascal will fill this need by introducing the reader to all these areas of Macintosh Pascal. Some knowledge of Pascal is needed but no previous exposure to the Macintosh is assumed. Chapter by chapter the reader will learn advanced Pascal concepts such as records, files, and pointers along with how to take advantage of the unique features of the Macintosh such as windowing and pulldown menus. Chapter 1 is an overview of the Macintosh, Macintosh Pascali and the memory structures of the Macintosh. The important memory concepts, such as the heap, the stack, and dynamic memory access through handle pointers, are covered. Chapter 2 introduces Pascal's "power" structures: sets, pointers, and records, which are not covered in detail by most Pascal books. These struc- tures are explained in relation to how they can be used in developing pro- grams. Simple Toolbox routines are introduced as reinforcement and motivation. Chapter 3 covers files and file processing. Files are the key to writing useful programs, yet information on their use and operation is scarce. This chapter teaches the techniques needed to store and retrieve data from both I

Reading notes: Text ends mid-word at 'from both I' Chapter 1 line reads 'Macintosh Pascali' apparently a typo for 'Pascal'

Printed product names
Macintosh Pascal · Advanced Macintosh Pascal
Languages
English
PDF page 11

xi Introduction sequential and random files on the Macintosh. Several example programs are presented including a program that composes poetry. Lazy I/O, totally neglected in most books, is discussed in order to give the reader the full understanding of how file input/ouptut is performed. Besides data files, the important text files are covered with special emphasis placed on the use of devices such as the printer and modem. Chapter 4 covers event programming, which is the key to developing Macintosh-like programs. Events allow a program to respond directly to user action such as keyboard and mouse input. The Toolbox routines that manage the event queue and report on events to programs are presented along with helpful programming examples. Chapter 5 reviews the basics of QuickDraw, the Macintosh's graphics package. The Macintosh graphics coordinate system, drawing, and manipulat- ing of geometric shapes and animation techniques are all discussed. Events and QuickDraw programming techniques are combined to simulate Macin- tosh controls such as pushbuttons and radio buttons. These simulations are easily transferable to other programs and are a simple way to implement Macintosh user interfaces in a program. Chapter 6, the major focus of the book, covers the Macintosh Pascal InLine procedures and functions. Using InLine procedures, programmers can access the Toolbox routines needed to create "real" Macintosh applications that conform to the Macintosh user interface standards. Learning how to access the Toolbox is of little use without detailed information on how the Toolbox routines operate. This chapter covers four of the major features of the Toolbox: the Window Manager, the Menu Manager, the Control Manager, and the TextEdit package. This information will allow the reader to create "real" Macintosh programs utilizing multiple windows, pulldown menus, controls such as pushbuttons and check boxes, and full mouse-based text editing. The programming techniques needed to combine these concepts with event han- dling are carefully developed and explained. Chapter 7 extends the reader's knowledge of QuickDraw by discussing some of the more sophisticated concepts. The information presented includes Grafports, control of fonts, regions, polygons, pictures, and drawing in color. Chapter 8 presents a complete application combining QuickDraw, Events, and file handling. The program called The Logger tracks computer usage and produces a log suitable for income tax purposes. Chapter 9 discusses the Standard Apple Numeric Environment, which includes the extended data types needed for scientific and business program- ming. SANE provides Macintosh Pascal with the accuracy (if not the speed) of the most powerful mainframe computers.

Reading notes: Source contains typo 'ouptut' in 'input/ouptut' Chapter 8 program name 'The Logger' shown with extra spacing in source

Printed product names
Macintosh · Macintosh Pascal · QuickDraw · The Logger
Languages
English