/* ** Newton Developer Technical Support Sample Code ** ** SoupDrink, a sample of the Newton Desktop Integration Libraries (DILs) ** ** by David Fedor, Rob Langhorne and J. Christopher Bell ** ** Copyright © 1995-1997 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 is a complete MacOS application which demonstrates use of the CDILs and the FDILs. It is designed to communicate with the SoupDrink-Newton package, which is a separate sample code project. You can obtain the DIL libraries, headers and documentation from http://dev.info.apple.com/newton/tools/dils.html Most of the interesting DIL code can be found in the file Engine.c, which holds the cross-platform code which makes most of the DIL API calls. The routine SetupPortMenu() demonstrates how to dynamically find the names of the available ports - these can be different on different models of MacOS computers, and change in localized versions of the MacOS System. The SoupDrink application has two test scripts. The first, "Soup Drink", will read the entire contents of any soup on the Newton device. It does this by sending a command to the Newton device indicating the name of the soup to read, and then repeatedly reading frames which are sent from the Newton application, converting them to text, and writing them to the file SoupData.out. The second test script, "Add New Name Card", constructs a name card frame for the built-in Names application, and sends it to the Newton device. The Newton SoupDrink application adds it to the Names soup. Note that the CSTR resources found in the file SoupDrink.rsrc must be linked in to every DIL application. They are used internally by the CDIL to find the appropriate Communications Toolbox files. These CSTR resources can also be found in the file CSTR.rsrc, which does not contain the SoupDrink-specific resources. NOTE: The "SPIT" command is supported for compatibility with older versions of this sample. If the SPIT command was sent instead of DRNK, a text version of the entry (NOT a frame) was sent. This was relevant only to a bug in some versions of Newton 1.x. See engine.c for more info. Modified April 1997 - cleaned up a few small bugs, and converted to CodeWarrior 11. Note that SoupDrink still uses the old ANSI libraries, not the MSL ones which are the default ones for CW11. Why? Because the MSL libraries don't by default include one for 2-byte integers and 8-byte longs, which is what the Mac DILs use right now. If you build your own 2i8d MSL library, things should work fine too.