// --------------------------------------------------------------------------------------
static void initialize(void)
{
	MenuBarHandle menuBar;
	OSErr error;
	
		/* I doubt we actually need any extra master pointers but I left the call here 
		   as a reminder for where it belongs if it is needed. */
	MoreMasterPointers(64);		// each call to MoreMasters allocates 64 master pointers
	
	InitCursor();
	RegisterAppearanceClient();
	
	menuBar = GetNewMBar(rMenuBar);		// draw the menu bar as soon as possible
	if (menuBar == NULL)
		ExitToShell();
	SetMenuBar(menuBar);
	DrawMenuBar();
	
		// do non time sensitive initialization after we get the application event loop going
	gOpenAppAEHandler = NewAEEventHandlerUPP(openApplicationAEHandler);
	error = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, gOpenAppAEHandler, 0, 
									false);
	if (error != noErr)
		ExitToShell();
	
		/* If we supported them, we would install open documents and print documents 
		   handlers here and we would do most of the same initialization stuff that 
		   we do in the open application handler. */
}
Exemple #2
0
void setUp()
{
	Handle	menuBar;
	OSErr 	anErr = noErr;
	long	aLong;
	long	response;
	
	anErr = Gestalt(gestaltSystemVersion, &response);
	
	// Carbon Porting guidelines say provide alternate menu bar/menu scheme for OS X
	// This is just one way of doing this, which is pretty static
	if (response >= 0x01000) 
		menuBar = GetNewMBar(MENU_BAR_IDX);
	else
		menuBar = GetNewMBar(MENU_BAR_ID);
	
	if ( menuBar == nil || anErr != noErr )
		 ExitToShell();	

	SetMenuBar(menuBar);
	DisposeHandle(menuBar);

	DrawMenuBar();
	
    // Install 'quit' event handler
	if ((Gestalt(gestaltAppleEventsAttr, &aLong) == noErr)) {
		    anErr = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
			         NewAEEventHandlerUPP(AEQuitHandler), 0, false);
		    if (anErr != noErr)  
		    	ExitToShell();
	}
}
// --------------------------------------------------------------------------------------
static void initialize(void)
{
	OSStatus status;
	IBNibRef nib;
	OSErr error;
	
	RegisterAppearanceClient();

	status = CreateNibReference(CFSTR("ExamplePrefs"), &nib);
	if (status != noErr)
		ExitToShell();
	
	status = SetMenuBarFromNib(nib, CFSTR("MenuBar"));
	if (status != noErr)
		ExitToShell();
	
	DisposeNibReference(nib);
	
	DrawMenuBar();
	
		// do non time sensitive initialization after we get the application event loop going
	gOpenAppAEHandler = NewAEEventHandlerUPP(openApplicationAEHandler);
	error = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, gOpenAppAEHandler, 0, 
									false);
	if (error != noErr)
		ExitToShell();
	
		/* If we supported them, we would install open documents and print documents 
		   handlers here and we would do most of the same initialization stuff that we 
		   do in the open application handler */
}
// --------------------------------------------------------------------------------------
static void initialize(void)
{
	MenuBarHandle menuBar;
	OSErr error;
	
	MoreMasters();				// I doubt we actually need any extra master pointers 
	InitGraf(&qd.thePort);		// but I left the calls here as a reminder for where they 
	InitFonts();				// belong if they are needed
	InitWindows();
	InitMenus();
	TEInit();
	InitDialogs(NULL);
	
	InitCursor();
	RegisterAppearanceClient();
	
	menuBar = GetNewMBar(rMenuBar);		// draw the menu bar as soon as possible
	if (menuBar == NULL)
		ExitToShell();
	SetMenuBar(menuBar);
	DrawMenuBar();
	
		// do non time sensitive initialization after we get the application event loop going
	gOpenAppAEHandler = NewAEEventHandlerUPP(openApplicationAEHandler);
	error = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, gOpenAppAEHandler, 0, 
									false);
	if (error != noErr)
		ExitToShell();
	
		/* If we supported them, we would install open documents and print documents 
		   handlers here and we would do most of the same initialization stuff that we 
		   do in the open application handler. */
	
	FlushEvents(everyEvent, 0);
}
Exemple #5
0
static pascal OSStatus EventHandler(
	EventHandlerCallRef nextHandler,	/* I - Next handler to call */
	EventRef            event,		/* I - Event reference */
	void                *userData)	/* I - User data (not used) */
{
	UInt32			kind;			/* Kind of event */
	Rect			rect;			/* New window size */
	EventMouseButton	button;			/* Mouse button */
	Point			point;			/* Mouse position */


	kind = GetEventKind(event);

	switch (kind)
	{
	case kEventWindowBoundsChanged:
		GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &rect);

		if (aglContext)
			aglUpdateContext(aglContext);

		altEngine.resize(rect.right - rect.left, rect.bottom - rect.top);
		break;

	case kEventWindowShown:
		WindowVisible = 1;
		break;

	case kEventWindowHidden:
		WindowVisible = 0;
		break;

	case kEventMouseDown:
		GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(EventMouseButton), NULL, &button);
		GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &point);
		//MouseFunc(button, 0, point.h, point.v);
		break;

	case kEventMouseUp:
		GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(EventMouseButton), NULL, &button);
		GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &point);
		//MouseFunc(button, 1, point.h, point.v);
		break;

	case kEventMouseDragged:
		GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &point);
		//MotionFunc(point.h, point.v);
		break;

	case kEventWindowClose:
		altEngine.destroy();
		ExitToShell();
		break;
	default:
		return CallNextEventHandler(nextHandler, event);
	}


	return noErr;
}
// --------------------------------------------------------------------------------------
void  OpenPrefsDialog(void)
{
	DialogRef dialog;
	WindowRef dialogWindow;
	ControlRef control;
	ListHandle iconList;
	Cell theCell;
	
	dialog = GetNewDialog(rPrefsDialogPlatinum, NULL, kFirstWindowOfClass);
	if (dialog == NULL)
		ExitToShell();
	SetPortDialogPort(dialog);
	dialogWindow = GetDialogWindow(dialog);
	
	SetDialogDefaultItem(dialog, kStdOkItemIndex);
	SetDialogCancelItem(dialog, kStdCancelItemIndex);
	
	GetDialogItemAsControl(dialog, iIconList, &control);
	GetControlData(control, kControlEntireControl, kControlListBoxListHandleTag, 
					sizeof(ListHandle), &iconList, NULL);
 	
	AddRowsAndDataToIconList(iconList, rIconListIconBaseID);
	(*iconList)->selFlags = lOnlyOne;
	
	SetPt(&theCell, 0, 0);
	LSetSelect(true, theCell, iconList);
	SetKeyboardFocus(dialogWindow, control, kControlFocusNextPart);
	gPanelNumber = 0;
		
	DisableMenuItem(GetMenuRef(mDemonstration), iPrefsDialog);
	ShowWindow(dialogWindow);
} // OpenPrefsDialog
Exemple #7
0
void
TclPlatformExit(
    int status)		/* Ignored. */
{
    TclMacExitHandler();
    ExitToShell();
}
Exemple #8
0
bool AquaGui::init(int argc, char **argv[]) /* Self-explainatory */
{

	OSErr err;
	long response;
	Str255 text = " OS X version lower than 10.4 is not supported!", tmp = "";
  
	/* Version check */
	err = Gestalt(gestaltSystemVersion, &response);
	Boolean ok = ((err == noErr) && (response >= 0x00001040));
	
   	if (!ok)
      {
      StandardAlert(kAlertStopAlert, text, tmp, NULL, NULL);
      ExitToShell();
      }
      	
  	_glue.init(argc, argv);

    _renderer = _glue.createRenderHandler();
    if(!_renderer)return false;

    set_render_handler(_renderer);
    return true;

}
// Parse a single resource
bool XML_ResourceFork::ParseResource(ResType Type, short ID)
{
    ResourceHandle = Get1Resource(Type,ID);
    if (ResourceHandle == NULL) {
        return false;
    }

    HLock(ResourceHandle);
    if (!DoParse()) {
        const char *Name = SourceName ? SourceName : "[]";
#ifdef TARGET_API_MAC_CARBON
        csprintf(
            temporary,
            "There were configuration-file parsing errors in resource %hd of object %s",
            ID,Name);
        SimpleAlert(kAlertStopAlert,temporary);
#else
        psprintf(
            ptemporary,
            "There were configuration-file parsing errors in resource %hd of object %s",
            ID,Name);
        ParamText(ptemporary,0,0,0);
        Alert(FatalErrorAlert,NULL);
#endif
        ExitToShell();
    }
    HUnlock(ResourceHandle);
    ReleaseResource(ResourceHandle);
    return true;
}
Exemple #10
0
/*--------------------------------------------------------------------------
 Searches for stub and if it exists, notifies it of pending exit and if it
  wants NetShell relaunched (yes if status is zero) then exits application.
--------------------------------------------------------------------------*/
DP_API void dpExitFromApp(int status)
{
	OSErr err;
	ProcessSerialNumber stubPSN;

	if (!status) {
		err = getstub(&stubPSN);
		if (err == dp_RES_OK ) {
			int done = 0;
			TargetID sender;
			unsigned long msgRefcon = REFCON;
			unsigned long sendRefcon, myOpts, msglen;
			EventRecord event;
			event.what = kHighLevelEvent;
			event.message = STUB_EVENTID;
			event.where = longtopt(STUB_OBITCLASS);
			myOpts = receiverIDisPSN  + nAttnMsg;
			err = PostHighLevelEvent(&event, &stubPSN, msgRefcon, nil, 0, myOpts);
			if (err != noErr) {
				DPRINT(("post to stub about die error %d\n", err));
			}
		}
	}
	ExitToShell();
}
Exemple #11
0
void MakeMenu()		/* Put up a menu */
{
    Handle	menuBar;
    MenuRef	menu;
    long	response;
    OSErr	err;
	
    menuBar = GetNewMBar(rMenuBar);	/* read menus into menu bar */
    if ( menuBar != nil )
    {
        SetMenuBar(menuBar);	/* install menus */
        // AppendResMenu(GetMenuHandle(mApple), 'DRVR');
        
        err = Gestalt(gestaltMenuMgrAttr, &response);
	if ((err == noErr) && (response & gestaltMenuMgrAquaLayoutMask))
        {
            menu = GetMenuHandle( mFile );
            DeleteMenuItem( menu, iQuit );
            DeleteMenuItem( menu, iQuitSeparator );
        }
        
        DrawMenuBar();
    }
    else
    	ExitToShell();
}
Exemple #12
0
void DoMenuCommand(long menuResult)
{
    short	menuID;		/* the resource ID of the selected menu */
    short	menuItem;	/* the item number of the selected menu */
	
    menuID = HiWord(menuResult);    /* use macros to get item & menu number */
    menuItem = LoWord(menuResult);
	
    switch (menuID) 
    {
        case mApple:
            switch (menuItem) 
            {
                case iAbout:
                    DoAboutBox();
                    break;
                    
                case iQuit:
                    ExitToShell();
                    break;
				
                default:
                    break;
            }
            break;
        
        case mFile:
            break;
		
        case mEdit:
            break;
    }
    HiliteMenu(0);	/* unhighlight what MenuSelect (or MenuKey) hilited */
}
void __exit(int status)
{
#if __dest_os != __be_os
	#pragma unused(status)
#endif
	
	__begin_critical_region(atexit_funcs_access);

	while (__atexit_curr_func > 0)
		(*__atexit_funcs[--__atexit_curr_func])();
	
	__end_critical_region(atexit_funcs_access);
	
	__kill_critical_regions();
	
	if (__console_exit)
	{
		(*__console_exit)();
		__console_exit = 0;
	}

#if __dest_os == __mac_os

	ExitToShell();

#elif __dest_os == __be_os															/* ELR */

	___teardown_be(status);

#elif __dest_os == __win32_os		

	ExitProcess(status);													

#endif
}
Exemple #14
0
/*
 * Do a SystemTask() call and check for abort key sequence.
 */
void STasks()
{
	SystemTask();
	if (isAbortEvent()) {
		printf("ABORTING...\n");
		ExitToShell();
	}
}
Exemple #15
0
// This will quit the application when the main window is closed
//
pascal OSStatus DoWindowClose(EventHandlerCallRef nextHandler, EventRef theEvent, void *userData)
{
    // If the window closes, quit
    ExitToShell();

    // Even though this never gets executed, this is needed to prevent compiler warnings
    return noErr;
}
Exemple #16
0
/**
 * Quit AppleEvent handler.
 */
static pascal OSErr handleQuitApplication(const AppleEvent*, AppleEvent*, long)
{
    if (gTheApp != nsnull) {
        gTheApp->Exit();
    } else {
        ExitToShell();
    }
    return noErr;
}
static int open_PlayerWin()
		/*success-> return 0;*/
{
	int	i;
	OSErr	err;
	RGBColor	back={0,0,0},
				fore={65535,65535,65535};
	
	open_window( &win, kPlayerWinID);
	position_window(&win);
	
	SetPortWindowPort(win.ref);
	RGBForeColor(&fore);
	RGBBackColor(&back);
	logo= GetPicture(128);
	logoDown= GetPicture(132);
	
	for(i=0; i<6; i++)
		button[i]= GetCIcon(i+200);
	iconPlay=GetCIcon(210);
	iconPause=GetCIcon(211);
	iconVol=GetCIcon(206);
	iconTab=GetCIcon(207);
	iconNotLoop=GetCIcon(208);
	iconLoop=GetCIcon(209);
	
	if(gHasDragMgr)
	{
		receiveRgn=NewRgn();
		if( receiveRgn )
		{
			GetWindowContentRgn(win.ref, receiveRgn);
			err=InstallTrackingHandler(NewDragTrackingHandlerProc(DragTrackingProc),
								(WindowPtr)win.ref, 0);
			if(err) ExitToShell();
			
			err=InstallReceiveHandler(NewDragReceiveHandlerProc(DragReceiveFunc),
							(WindowPtr)win.ref, 0);
			if(err) ExitToShell();
		}
	}
	return 0;
}
Exemple #18
0
void Initialize()	/* Initialize some managers */
{
    OSErr	err;
        
    InitCursor();

    err = AEInstallEventHandler( kCoreEventClass, kAEQuitApplication, NewAEEventHandlerUPP((AEEventHandlerProcPtr)QuitAppleEventHandler), 0, false );
    if (err != noErr)
        ExitToShell();
}
Exemple #19
0
/*********************************************************************
* CreateTerminal: Initialize the structure which will hold all
*   the text for the terminal.
*********************************************************************/
void CreateTerminal ( void )

{
	int i;
	Terminal = (char **) malloc (sizeof(char *)*(DIALOG_SIZE+1));
   if ( Terminal == NULL )
      ExitToShell();
   for (i=0; i<=(DIALOG_SIZE); i++)
      Terminal[i] = NULL;
}
/*****************************************************
*
* main (argc, argv) 
*
* Purpose:  main program entry point
*
* Notes:	   You might want to change this to something more verbose
*
* Inputs:   argc     - the number of elements in the argv array
*				argv     - an array of pointers to the parameters to this application
*
* Returns:  int      - error code (0 == no error) 
*/
int main(int argc, char* argv[])
	{
	OSStatus status;
	
	// Can we run this particular demo application?
	long response;
	status = Gestalt(gestaltSystemVersion, &response);
	Boolean ok = ((noErr == status) && (response >= 0x00001030));
	if (!ok)
		{
		DialogRef theAlert;
		CreateStandardAlert(kAlertStopAlert, CFSTR("Mac OS X 10.3 (minimum) is required for this application"), NULL, NULL, &theAlert);
		RunStandardAlert(theAlert, NULL, NULL);
		ExitToShell();
		}
	
	// Create a Nib reference passing the name of the nib file (without the .nib extension)
	// CreateNibReference only searches into the application bundle.
	status = CreateNibReference(CFSTR("main"), &gIBNibRef);
	require_noerr(status, CantGetNibRef);
	
	// Once the nib reference is created, set the menu bar. "MainMenu" is the name of the menu bar
	// object. This name is set in InterfaceBuilder when the nib is created.
	status = SetMenuBarFromNib(gIBNibRef, CFSTR("MenuBar"));
	require_noerr(status, CantSetMenuBar);
	
	// Adding a Font menu
	MenuRef fontMenu = GetMenuRef(3);
	require(fontMenu != NULL, CantSetMenuBar);
	status = CreateStandardFontMenu(fontMenu, 0, 0, 0, NULL);
	require_noerr(status, CantSetMenuBar);
	
	// Enabling Preferences menu item
	EnableMenuCommand(NULL, kHICommandPreferences);
	
	// Let's react to User's commands.
	Install_AppleEventHandlers();
	
	EventTypeSpec eventTypeCP = {kEventClassCommand, kEventCommandProcess};
	InstallEventHandler(GetApplicationEventTarget(), Handle_CommandProcess, 1, &eventTypeCP, NULL, NULL);
	
	EventTypeSpec eventTypeCUS = {kEventClassCommand, kEventCommandUpdateStatus};
	InstallEventHandler(GetApplicationEventTarget(), Handle_CommandUpdateStatus, 1, &eventTypeCUS, NULL, NULL);
	
	EventTypeSpec eventTypeAA = {kEventClassApplication,  kEventAppActivated};
	InstallEventHandler(GetApplicationEventTarget(), Handle_AppActivated, 1, &eventTypeAA, NULL, NULL);
	
	// Call the event loop
	RunApplicationEventLoop();
	
CantSetMenuBar:
CantGetNibRef:
	return status;
	}   // main
// --------------------------------------------------------------------------------------
void AddRowsAndDataToIconList(ListHandle iconList, SInt16 iconFamilyBaseID)
{
	short dataLength, rowNumber;
	IconListCellDataRec cellData;
	Cell theCell;
	
	if (!gIconsRegistered)		// if we didn't register our icons already, we need to
	{
		OSErr error;
		FSSpec iconResFile;
		
			/* The first thing we need to do to register an IconRef is to get the FSSpec 
			   for the file containing the icon resources.  This could be the 
			   application file itself or a flattened resource file in a bundle.  Either 
			   way, in this program it's the "current" resource file so we call our 
			   utility function that converts the file reference number returned by 
			   CurResFile to an FSSpec. */
		error = getCurrentResourceFSSpec(&iconResFile);
		
		if (error != noErr)		// if we can't get our icons, this program is kind of useless
			ExitToShell();
		
			// we've got the FSSpec, now get the icons out of it
		dataLength = sizeof(IconListCellDataRec);
		
		for (rowNumber = 0; rowNumber < kNumberOfRows; rowNumber++)
		{
			RegisterIconRefFromResource(kAppSignature, 'LIc0' + rowNumber, &iconResFile, 
										iconFamilyBaseID + rowNumber, &cellData.icon);
			GetIndString(cellData.name, rIconListStrings, rowNumber + 1);
			
			rowNumber = LAddRow(1, rowNumber, iconList);	// add each row to the 
			SetPt(&theCell, 0, rowNumber);					// bottom of the List
			LSetCell(&cellData, dataLength, theCell, iconList);
		}
		
		gIconsRegistered = true;
	}
	else	// the icons are already registered so we just have to get them
	{
		dataLength = sizeof(IconListCellDataRec);
		
		for (rowNumber = 0; rowNumber < kNumberOfRows; rowNumber++)
		{
			GetIconRef(kOnSystemDisk, kAppSignature, 'LIc0' + rowNumber, &cellData.icon);
			
			GetIndString(cellData.name, rIconListStrings, rowNumber + 1);
				
			rowNumber = LAddRow(1, rowNumber, iconList);	// add each row to the 
			SetPt(&theCell, 0, rowNumber);					// bottom of the List
			LSetCell(&cellData, dataLength, theCell, iconList);
		}
	}
}
Exemple #22
0
void MakeWindow()	/* Put up a window */
{
    Rect	wRect;
    WindowRef	myWindow;
    
    SetRect(&wRect,50,50,600,200); /* left, top, right, bottom */
    myWindow = NewCWindow(nil, &wRect, "\pHello", true, zoomNoGrow, (WindowRef) -1, true, 0);
    
    if (myWindow != nil)
        SetPort(GetWindowPort(myWindow));  /* set port to new window */
    else
	ExitToShell();					
}
Exemple #23
0
void error(const char *format,...)
{
	Str255 buf;
	va_list ap;

	va_start(ap, format);
	vsprintf((char *)buf, format, ap);
	va_end(ap);

	C2P((char *)buf, buf);
	ParamText(buf, (StringPtr)"", (StringPtr)"", (StringPtr)"");
	Alert(128, (ModalFilterUPP) NULL);
	ExitToShell();
}
// --------------------------------------------------------------------------------------
static pascal OSErr openApplicationAEHandler(const AppleEvent *appleEvent, AppleEvent *reply, 
												long refcon)
{
#pragma unused (reply, refcon)
	OSErr error;
	DescType returnedType;
	Size actualSize;
	
	error = AEGetAttributePtr(appleEvent, keyMissedKeywordAttr, typeWildCard, &returnedType,
								NULL, 0, &actualSize);
	if (error == noErr)
		error = errAEParamMissed;
	else if (error == errAEDescNotFound)
	{
		EventTypeSpec applicationEvents[] = {
												{kEventClassCommand, kEventCommandProcess}
		                                    };
		
			/* For our program running in Carbon, a Quit Application Apple Event handler 
			   is unnecessary because RunApplicationEventLoop installs one for us that 
			   calls QuitApplicationEventLoop.  However we will leave ours here in case 
			   we ever need it to do something different so that we know where it 
			   belongs. */
		gQuitAppAEHandler = NewAEEventHandlerUPP(quitApplicationAEHandler);
		error = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, gQuitAppAEHandler, 
										0, false);
		if (error != noErr)		// if we can't allow the user a mechanism to quit
		{						// we'd better just quit right now
			DisposeAEEventHandlerUPP(gOpenAppAEHandler);
			DisposeAEEventHandlerUPP(gQuitAppAEHandler);
			
			ExitToShell();
		}
		gViewsFontChangedAEHandler = NewAEEventHandlerUPP(viewsFontChangedAEHandler);
		error = AEInstallEventHandler(kAppearanceEventClass, kAEViewsFontChanged, 
										gViewsFontChangedAEHandler, 0, false);
		
		gAppEventHandler = NewEventHandlerUPP(appEventHandler);
		InstallApplicationEventHandler(gAppEventHandler, GetEventTypeCount(applicationEvents), 
										applicationEvents, NULL, NULL);
		
		Gestalt(gestaltSystemVersion, &gMacOSVersion);	// get the version of Mac OS we're 
														// running on
		InitIconDataBrowser();
		
		error = noErr;
	}
	
	return error;
}
// Reports a read error
void XML_ResourceFork::ReportReadError()
{
    const char *Name = SourceName ? SourceName : "[]";
#ifdef TARGET_API_MAC_CARBON
    csprintf(temporary,
             "Error in reading resource fork of object %s",Name);
    SimpleAlert(kAlertStopAlert,temporary);
#else
    psprintf(ptemporary,
             "Error in reading resource fork of object %s",Name);
    ParamText(ptemporary,0,0,0);
    Alert(FatalErrorAlert,NULL);
#endif
    ExitToShell();
}
Exemple #26
0
// Main entry point
int
main(int argc, char* argv[])
{
    IBNibRef nibRef;
    WindowRef window;
    OSStatus status;
		
   // Can we run this particular demo application?
	long response;
	status = Gestalt(gestaltSystemVersion, &response);
	Boolean ok = ((status == noErr) && (response >= 0x00001030));
	if (!ok)
	{
		StandardAlert(kAlertStopAlert, (const StringPtr)"\pMac OS X 10.3 (minimum) is required for this application", (const StringPtr)"\p", NULL, NULL);
		ExitToShell();
	}
Exemple #27
0
void EventLoop()
{
    Boolean	gotEvent;
    EventRecord	event;
        
    gQuitFlag = false;
	
    do
    {
        gotEvent = WaitNextEvent(everyEvent,&event,32767,nil);
        if (gotEvent)
            DoEvent(&event);
    } while (!gQuitFlag);
    
    ExitToShell();					
}
Exemple #28
0
int 	main( int argc, char *argv[] )

	{

	
#ifdef OS9 
	ToolboxInit();

	

	if ( HasAppearance() )

		RegisterAppearanceClient();
#endif
	



	game.InitGL();

	

	game.InitGame();

	

	game.EventLoop();

	

	game.Dispose();

	
#ifdef OS9 
	if ( HasAppearance() )

		UnregisterAppearanceClient();

	

	FlushEvents( everyEvent, 0 );

	ExitToShell();
#endif
	

}
// Reports an XML parsing error
void XML_ResourceFork::ReportParseError(const char *ErrorString, int LineNumber)
{
    const char *Name = SourceName ? SourceName : "[]";
#ifdef TARGET_API_MAC_CARBON
    csprintf(temporary,
             "XML parsing error: %s at line %d in object %s",ErrorString,
             LineNumber,
             Name);
    SimpleAlert(kAlertStopAlert,temporary);
#else
    psprintf(ptemporary,"XML parsing error: %s at line %d in object %s",
             ErrorString,LineNumber,
             Name);
    ParamText(ptemporary,0,0,0);
    Alert(FatalErrorAlert,NULL);
#endif
    ExitToShell();
}
void CheckError(OSErr error, char *msg)
{
	if (error == noErr)
	{
		return;
	}
	if (strlen(msg) > 0)
	{
		#if TARGET_OS_MAC
			Utils_Macintosh_DisplayMsg(msg);
		#else if TARGET_OS_WIN32
			Utils_Win32_DisplayMsg(msg);
		#endif
		

		ExitToShell();

	}
}