/************************************************************************************************** * XFunctionsMain.c * * Written By: Brian Powell * (c) 1991, All Rights Reserved. * * This contains the main function for the external modules. Whenever Imagic makes a * call to an external function, this is the function that gets called. This then * interprets the type of call that Imagic made and calls the correct function from there. * *************************************************************************************************/ /* Include these files. */ #include "XFunctionNumbers.h" #include "XFunctions.h" ProcPtr (*(**functions)()); /* We don't want the file SetUpA4.h at the top of the program because this file generates code * that we don't want put into our program. Therefore, it needs to go down here so that it will * not stick code into our file. */ #include pascal OSErr main (message, Functions, parameters) int message; ProcPtr (*(**Functions)()); InitStruct *parameters; { OSErr Error = noErr; /* Set up register A4 so that we can use global variables correctly. * See the Think C Users Manual, page 87 for more details. * (The 1989 version of the Think C 4.0 manual). * ---> Addendum <--- * For Think C 5.0, see page 119 of the Think C 5.0 User's Manual. */ RememberA0(); SetUpA4(); functions = Functions; switch (message) { case INITIALIZE: Error=Initialize(parameters); parameters->Version = EXTERNAL_FUNCTION_LIBRARY_VERSION_NUM; break; case MENU_ITEM: Error=ExecuteMenu(); break; case SHUT_DOWN: Error=Exit(); break; } /* Restore register A4 to it's original value. */ RestoreA4(); /* Return the error code (if any). */ return Error; }