/*
**      Newton Developer Technical Support Sample Code
**
**      Chez DTS - How to register application pieces and not waste heap
**
**      by David Fedor, Newton Developer Technical Support
**
**      Copyright © 1996 by Apple Computer, Inc.  All rights reserved.
** 
**      You may incorporate this sample code into your applications without
**      restriction.  This sample code has been provided "AS IS" and the
**      responsibility for its operation is 100% yours.  You are not
**      permitted to modify and redistribute the source as "DTS Sample Code."
**      If you are going to re-distribute the source, we require that you
**      make it clear in the source that the code was descended from
**      Apple-provided sample code, but that you've made changes.
*/


This sample illustrates the most memory-efficient way to create a
registry, which various packages can use to provide a pointer to some
package data.  The registered packages may be placed on a card and will
safely unregister themselves when the card is removed, without causing the
"Grip of Death" message: "The Newton still needs the card."

This is accomplished by creating a global frame, with one slot per
registered package.  When the frame is first created, it is TotalCloned to
ensure it is completely in the NewtonScript heap.  Then as each package
registers itself in that frame, only the symbol is passed to
EnsureInternal - thus the entry can be removed from the frame after the
card has been pulled out.

The code to do this registering is all in "ChezDTS constants", which is
included by all of the other projects.

If code tried to access the registered frame after the card was removed,
it would cause the "Put back the card" dialog.  There's no way to remove
this restriction without cloning the entire contents of each package,
which would use much too much heap.

The project "Chez DTS" is the main application package; it displays a menu
of the installed packages.  The other projects are items which will be
placed on the "Chez DTS" menu.

Any of the packages can be placed on a card; the only time the "put back
the card" dialog will appear is if the user has the "Chez DTS" application
on the card, and has it open when the card is pulled.
