CucumberDoc.tioga
Spreitzer, July 8, 1985 5:55:08 pm PDT
Cucumber
CEDAR 6.0 — FOR INTERNAL XEROX USE ONLY
Cucumber
Mike Spreitzer
© Copyright 1985 Xerox Corporation. All rights reserved.
Abstract: Cucumber solves a simplified version of the pickeled value problem. It will read and write values from and to IO.STREAMs. It knows how to deal with simple things (numbers, ropes, booleans, etc.) and aggregates (records and arrays) of them. For other kinds of things (e.g., refs) the client must register procedures to do the reading and writing. Hard issues, like non-tree-structured data, or changing types, are not dealt with.
Created by: Mike Spreitzer
Maintained by: Mike Spreitzer <Spreitzer.pa>
Keywords: Value, Stream, File, Read, Write, IO, Pickled Value
XEROX  Xerox Corporation
   Palo Alto Research Center
   3333 Coyote Hill Road
   Palo Alto, California 94304

For Internal Xerox Use Only
1. Usage
The interface is named Cucumber. The main procedure of interest is Transfer. Note that you must give it a REF (even for input). It reads from/writes to the bits pointed to by that REF. If you're really lucky, you don't have to think any further. If you're not, it's because your referent is not simply an aggregate of simple things. For the non-simple elements of your referent, you have to have provided a way for Cucumber to do the transfer. You do this by registering with the referent type (not the non-simple element type) a Handler. If you're really lucky, you'll decide that the non-simple elements of your referent will not need to be transferred, and thus the Handler's PartTransferProc will do nothing. Another relatively easy case is when the non-simple element is a REF, and what you want to do is to transfer the REF's referent --- in which case the Handler's PartTransferProc can recursively call Transfer. You can always do something "special". For example, suppose a non-simple element is a Viewer ( = REF ViewerRec) at the top level (no parents), and you're assuming such Viewers are managed by some other program(s) and will always be there. The Handler's PartTransferProc could, on output, simply write the Viewer's name, and on input read the name and ViewerOps.FindViewer.
2. Examples
For examples, see the uses in Rosemary.