home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
online
/
source
/
c
/
compilers
/
Tickle-4.0.sit.hqx
/
Tickle-4.0
/
src
/
tickle.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-11-18
|
4KB
|
206 lines
/*
** This source code was written by Tim Endres
** Email: time@ice.com.
** USMail: 8840 Main Street, Whitmore Lake, MI 48189
**
** Some portions of this application utilize sources
** that are copyrighted by ICE Engineering, Inc., and
** ICE Engineering retains all rights to those sources.
**
** Neither ICE Engineering, Inc., nor Tim Endres,
** warrants this source code for any reason, and neither
** party assumes any responsbility for the use of these
** sources, libraries, or applications. The user of these
** sources and binaries assumes all responsbilities for
** any resulting consequences.
*/
/*
** The following macro definition will cause the global varaible
** definitions to allocate storage, versus just "extern" definitions.
** One and only one compiled file should declare this macro.
** (refer to pages 28-30, "Scope; External Variables",
** in Kernigan and Richie, "The C Programming Language").
*/
#define ALLOCATE_GLOBALS 1
#undef USEDUMP
#undef MAKEDUMP
#include "tickle.h"
#include "TGE.h"
#include "asd.h"
#include "mb.h"
char **environ = NULL;
main(argc, argv, envp)
int argc;
char *argv[];
char *envp[];
{
int myerr, i;
long gestaltLong;
char **myenv;
#pragma unused (argc, argv)
#ifdef THINK_C
myenv = NULL;
#else
myenv = envp;
#endif
if (myenv == NULL)
{
environ = (char **) malloc( 5 * sizeof(char *) );
if (environ == NULL)
{
exit(0);
}
i = 0;
#ifdef TCL_LIBRARY
{
char buffer[1024];
sprintf(buffer, "TCL_LIBRARY=%s", TCL_LIBRARY);
environ[i] = ckalloc( strlen(buffer) + 1 );
strcpy(environ[i++], buffer);
}
#else
environ[i++] = "TCL_LIBRARY=:library";
#endif
#ifdef THINK_C
environ[i++] = "THINK_VERSION=1";
#endif
#ifdef MPW
environ[i++] = "MPW_VERSION=1";
#endif
environ[i] = NULL;
}
else
{
environ = myenv;
}
/*
** Initialize the Macintosh ROM managers that the Unifolder application
** uses. This is required by all Macintosh applications.
*/
/* Increase stack space by 48,000 bytes */
SetApplLimit(GetApplLimit() - (48 * 1024));
/* Expand the application heap zone to the maximum. */
MaxApplZone();
/* Allocate a bunch of master pointers. */
MoreMasters();
MoreMasters();
MoreMasters();
MoreMasters();
MoreMasters();
/*
** Initialize the Macintosh ROM managers that the Unifolder application
** uses. This is required by all Macintosh applications.
*/
InitGraf(&qd.thePort);
InitFonts();
#ifdef TCLAPPL
InitWindows();
#endif
InitMenus();
TEInit();
InitDialogs((ResumeProcPtr)0);
InitCursor();
InitAllPacks();
if (GestaltAvailable())
{
myerr = Gestalt(gestaltAliasMgrAttr, &gestaltLong);
if (myerr == noErr)
if ((gestaltLong & (1 << gestaltAliasMgrPresent)) != 0)
gHasAliases = true;
myerr = Gestalt(gestaltHelpMgrAttr, &gestaltLong);
if (myerr == noErr)
if ((gestaltLong & (1 << gestaltHelpMgrPresent)) != 0)
gHasBalloons = true;
myerr = Gestalt(gestaltFindFolderAttr, &gestaltLong);
if (myerr == noErr)
if ((gestaltLong & (1 << gestaltFindFolderPresent)) != 0)
gHasDirectory = true;
myerr = Gestalt(gestaltAppleEventsAttr, &gestaltLong);
if (myerr == noErr)
if ((gestaltLong & (1 << gestaltAppleEventsPresent)) != 0)
gHasAppleEvents = true;
myerr = Gestalt(gestaltStandardFileAttr, &gestaltLong);
if (myerr == noErr)
if ((gestaltLong & (1 << gestaltStandardFile58)) != 0)
gHasStandardFile = true;
}
memset(&theEnviron, 0, sizeof(SysEnvRec));
#define CurrentVersion 1
if (SysEnvirons(CurrentVersion, &theEnviron) != noErr)
{
theEnviron.environsVersion = -1;
theEnviron.hasColorQD = 0;
theEnviron.hasFPU = 0;
message_alert("%s%s",
"This is a *very* old Mac isn't it?\015Things may not operate properly.");
}
switch (theEnviron.keyBoardType)
{
case envMacKbd: /* "Macintosh" */
case envMacAndPad: /* "Macintosh with Pad" */
case envMacPlusKbd: /* "MacPlus" */
macplus_keybd = 1;
break;
}
/*
** Initialize things used by the application.
*/
InitApplication();
/*
** app_done = true --> Quit the application.
*/
app_done = false;
/*
** Loop forever on the application's event loop until
** the app_done flag is set by a "quit" command.
*/
while (! app_done) {
while (! app_done) do_event();
ShutDownApplication();
}
/*
** All done, exit...
*/
exit();
}