uuUndo/DSUserProcs.c

1 line
29 KiB
C
Raw Normal View History

2015-02-06 08:56:41 +00:00
/****************************************************************************** ** ** Project Name: DropShell ** File Name: DSUserProcs.c ** ** Description: Specific AppleEvent handlers used by the DropBox ** ******************************************************************************* ** A U T H O R I D E N T I T Y ******************************************************************************* ** ** Initials Name ** -------- ----------------------------------------------- ** LDR Leonard Rosenthol ** MTC Marshall Clow ** SCS Stephan Somogyi ** ******************************************************************************* ** R E V I S I O N H I S T O R Y ******************************************************************************* ** ** Date Time Author Description ** -------- ----- ------ --------------------------------------------- ** 01/25/92 LDR Removed the use of const on the userDataHandle ** 12/09/91 LDR Added the new SelectFile userProc ** Added the new Install & DisposeUserGlobals procs ** Modified PostFlight to only autoquit on odoc, not pdoc ** 11/24/91 LDR Added the userProcs for pdoc handler ** Cleaned up the placement of braces ** Added the passing of a userDataHandle ** 10/29/91 SCS Changes for THINK C 5 ** 10/28/91 LDR Officially renamed DropShell (from QuickShell) ** Added a bunch of comments for clarification ** 10/06/91 00:02 MTC Converted to MPW C ** 04/09/91 00:02 LDR Added to Projector ** ******************************************************************************/ #include "DSGlobals.h" #include "DSUserProcs.h" #include "DSDialogs.h" #include "DSUtilsASG.h" #include <Folders.h> #include <GestaltEqu.h> #include <ImageCompression.h> #include <ctype.h> #include <string.h> #include <stdio.h> //================================================================================================================================== // Globals //================================================================================================================================== typedef struct odocQueue { struct odocQueue *next; FSSpec spec; Handle data; } odocQueue, *odocQueuePtr; enum { cacheData = 0x10, dontCache = 0x20 }; static Boolean gAborted = false; static char *gInputBuffer = nil, *gOutputBuffer = nil; static char *gInputBufferBase = nil, *gOutputBufferBase = nil; static char *gInputBufferPtr = nil, *gOutputBufferPtr = nil; static ParamBlockRec gInputPB1, gInputPB2; static ParamBlockRec gOutputPB1, gOutputPB2; static HParamBlockRec gCloseOutputPB; static HParamBlockRec gOpenOutputPB; static HParamBlockRec gDeleteInputPB; static short gInputRefNum = 0, gOutputRefNum = 0; static Size gInputBufferLeft = 0, gOutputBufferCount = 0; static Size gTotalSize = 0, gBytesRead = 0, gLinesProcessed = 0; static Boolean gLastInputBuffer = false, gFoundEndCode = false; static odocQueuePtr godocQueue = nil; static IOCompletionUPP gGenericCompletion = nil; Boolean gProcessing = false, gHasCQD = false; enum { kInputBufferSize = 32L * 1024L, kOutputBufferSize = 32L * 1024L, kExtensionMapType = 'E2Ty', kExtensionMapID = 0 }; static OSErr OpenInputFile(FSSpecPtr theSpec); static OSErr FillInputBuffer(void); static OSErr CloseInputFile(FSSpecPtr theSpec); static char *GetNextInputLine(Size *length, Boolean *badUU); static char *GetNextUUInputLine(void); static OSErr OpenOutputFile(FSSpecPtr inSpec, FSSpecPtr outSpec, char *outName); static OSErr CreateOutputFile(FSSpecPtr outSpec, char *outName, OSType creator, OSType type); static void MapOutputExtension(char *outname, OSType *creator, OSType *type); static OSErr FlushOutputBuffer(void); static OSErr CloseOutputFile(FSSpecPtr theSpec); static OSErr DecodeUULine(char *line); static void AddToQueue(FSSpec *theSpec, Handle userData); static void ProcessQueue(void); static void DisableMenus(void); static void EnableMenus(void); #if defined(powerc) || defined(__powerc) static pascal void GenericCompletion(ParmBlkPtr paramBlock); #else s