Home | Polski | |
Go back |
A sidebar to the Apple Macintosh preview published in Byte, issue 2/1984, pp. 42. Sharing Data among Programs Macintosh programs, if they are designed in accordance with Apple guidelines, will be able to trade data among themselves without one program having to know anything about the nature of the others. This is done through use of a shared memory area called the clipboard and the standardization of the data that can be stored in it. The clipboard is a relocatable piece of memory that is not erased when a new program replaces an older one. It is used as follows: the first program copies data into the clipboard, the second program replaces the first with its own code and data, and the data in the clipboard is added to the data now in memory. The clipboard can contain a variable number of data items, though every item must be of a different type. Each data item consists of a four-character data-type identifier, a 32-bit length (in bytes), and a stream of bytes that makes up the actual contents of the data item. Programs are free to implement their own data types. Apple has defined two – text and Quickdraw pictures – and encourages every program to be able to read both and write at least one of these data types. Text is a simple ASCII string of characters without any information on the size, font, or position of the text. Quickdraw pictures are defined as a sequence of commands that can be understood by the Quickdraw routines. A Quickdraw picture can contain displayable text (which does include information on text size, font, and position on the screen), a sequence of elementary graphics commands that will recreate the image, or the image described as a stream of bits. These two data types provide a guaranteed means of communication among Macintosh programs. | |
Page added on 20th January 2004. Copyright © 2002-2005 Marcin Wichary |
Printable version | Contact | Site map |