//========================================================================================
// TI Calculator File Support Framework
//
// Primary API Types and Defines Module
// ©2001-2003 by Texas Instruments Incorporated
// All Rights Reserved.
//
// Software Design: Stephen L. Reid (MGTS)
// Initial Design : 05 March 2001
// OS X Framework : Sept 2, 2002
// Update to use FURLs and CFURL : Sept 10, 2002
//========================================================================================

#ifndef __TI_FILESUPPORT__
#define __TI_FILESUPPORT__

#pragma pack(1)

#define	myTIApplicationSuiteSignature	'TIco'

struct	TIFileFlags {
    DescType	customCreator;		// possible custom creator code
    UInt8	operationsFlags;	// operations flags for file ops
//
    UInt8	deviceID;		// incoming 'device' ID value
    UInt8	deviceProductID;	// device-product ID for flash devices
    UInt8	dataObjectType;		// device-specific data object type
    Boolean	isAFlashObject;		// true=flash object in spec, else false.
};
typedef struct TIFileFlags TIFileFlags;


// enumerated flags for operations use.
enum {
    CREATE_TEMPORARY_FILE		= (UInt8)0x01,		// create the output file in 'temporary items' folder
    INPUT_FURL_IS_DIRECTORY		= (UInt8)0x02,		// the input furl is a 'directory' file url
    DELETE_INPUT_OBJECTS		= (UInt8)0x04,		// when done writing objects, dispose the input AEDesc objects
    AUTOTYPE_ALL_FILES			= (UInt8)0x08,		// automatically set appropriate file types and creator codes
    WRITE_TO_GROUP              = (UInt8)0x10,		// always write a group file.
    OVERWRITE_EXISTING_FILE		= (UInt8)0x20,		// overwrite any existing files without reporting error
    GROUP_IS_REPORT             = (UInt8)0x40		// write lab report instead of group file (89/92/92+ only)
};

#pragma pack(4)
//========================================================================================
// This is a file operations parameter block.  The first section is data in common with
// the communications parameter block.
//========================================================================================
struct TIFileOperationsParmBlock {
	TIFileSelector		fileFunction;			// read write selector
	SInt64              fileRefCon;				// temp refcon value.
	volatile IOReturn	fileResult;				// result code of operation
	AEDesc              fileAEDesc;				// AE desc/list of data
	AEDesc              fileSpec;				// AEDesc containing 'furl' (typeFileURL) (read/write/identify, may be directory)
	AEDescList          fileAEList;				// list of fURLs of where files are (write)
    FSRef               fileRef;				// my 'FSRef' for the current file in use.
    FSSpec              fileFSSpec;				// an FSSpec for the current file in use.
	FSIORefNum			forkReference;			// open 'fork' ref num
	Boolean             filePBType;				// TRUE= allocated in support, FALSE=NOT allocated
// for internal framework use during file opening/creation process	//
    OSType              fileType;
    OSType              fileCreator;
    TIFileFlags         file;					// other file op/flags
};

typedef struct TIFileOperationsParmBlock TIFileOperationsParmBlock;
//========================================================================================




//========================================================================================
// End of TI_API_Types.h
//========================================================================================
#endif