Exemplo n.º 1
0
Boolean
VerifyEnv(void)
{
	long	response;
	OSErr 	err = noErr;
	Boolean bEnvOK = true;
	
	// gestalt to check we are running 8.5 or later
	err = Gestalt('sysv', &response);
	if (err != noErr)
	{
		// errors already!  we are bailing
        ErrorHandler(err, nil);
		bEnvOK = false;
	}
	
	if (response < 0x00000850)
	{
		// we are bailing
		StopAlert(160, nil);
		bEnvOK = false;
	}
	
	// it's all good
	return bEnvOK;
}
Exemplo n.º 2
0
void ErrorHandler(short errCode, Str255 msg)
{
// TO DO
//		* handle a "fatality" parameter for recovery

    Str255      pErrorStr;
    Str255      pMessage, errMsg;
    char        *cErrNo = 0;
    StringPtr   pErrNo = 0;
    AlertStdAlertParamRec *alertdlg;

    // only throw up the error dialog once (since we have no fatality param)
    static Boolean bErrHandled = false;
    if (bErrHandled)
        return;
    else
        bErrHandled = true;
        
    // if install.ini read failed
    if( errCode == eInstRead )
    {
        GetIndString(pErrorStr, rStringList, errCode);
        ParamText(pErrorStr, "\p", "\p", "\p");
        StopAlert(rAlrtError, nil);
        SysBeep(10);
        gDone = true;
        return;
    }
Exemplo n.º 3
0
static pascal DialogItemIndex MyAlert (UInt8 whichAlert, ConstStr255Param str1, ConstStr255Param str2)
{
	DialogItemIndex result = kDialogItemIndexNone;

	if (!AEInteractWithUser (kNoTimeOut,NULL,NULL))
	{
		ParamText (LMGetCurApName ( ), str1 ? str1 : "\p", str2 ? str2 : "\p", "\p");

		InitCursor ( );

		switch (whichAlert)
		{
			case kAlertIndex_ShortField :

				result = CautionAlert (kResID_Base + whichAlert, gStandardModalFilterUPP);
				break;

			default :

				result = StopAlert (kResID_Base + whichAlert, gStandardModalFilterUPP);
				break;
		}

		if (MoreAssertPCG (result != kDialogItemIndexNone))
		{
			EventRecord modifiers;
			OSEventAvail (0,&modifiers);
			if (modifiers.modifiers & optionKey)
				Debugger ( );
		}
	}
Exemplo n.º 4
0
void modalfatalbox(char *fmt, ...) {
    va_list ap;
    Str255 stuff;
    
    va_start(ap, fmt);
    /* We'd like stuff to be a Pascal string */
    stuff[0] = vsprintf((char *)(&stuff[1]), fmt, ap);
    va_end(ap);
    ParamText(stuff, NULL, NULL, NULL);
    StopAlert(128, NULL);
    cleanup_exit(1);
}
Exemplo n.º 5
0
static int MessageBox(char *szMessage, char *szBoxTitle)
{
	Str255 stBoxTitle;
	Str255 stMessage;
	short item;

	BltStSz(stBoxTitle, szBoxTitle);
	BltStSz(stMessage, szMessage);
	ParamText(stBoxTitle, stMessage, "\p", "\p");

	item = StopAlert(alrtAbortRetryIgnore, (ModalFilterUPP)NULL);
				
	// which button was returned?
	if (item == -1)		// no dialog displayed
		item = 1;
	item += (IDABORT - 1);	// case MB_ABORTRETRYIGNORE

	return item;
}
Exemplo n.º 6
0
/*
================
Sys_Error
================
*/
void Sys_Error( const char *error, ... ) {
	va_list		argptr;
	char		string[1024];
	char		string2[1024];

	Sys_Shutdown();

	va_start (argptr,error);
	vsprintf (string2+1,error,argptr);
	va_end (argptr);
	string2[0] = strlen( string2 + 1 );
	
	strcpy( string+1, "Quake 3 Error:" );
	string[0] = strlen( string + 1 );
	
	// set the dialog box strings
	ParamText( (unsigned char *)string, (unsigned char *)string2, 
	(unsigned char *)string2, (unsigned char *)string2 );

	// run a dialog
	StopAlert( 128, NULL );
	
	exit(0);	
}
Exemplo n.º 7
0
pascal short SafeStopAlert(short alertID, ModalFilterUPP modalFilter)
{
	StAcroResourceContext resContext;

	return StopAlert(alertID, modalFilter);
}
Exemplo n.º 8
0
DoStartup()
  {
   int theMessage;
   int nDocs;
   int thisDoc;
   AppFile docInfo;
   int ignore;
  
   /*======================================================*/
   /* Get the number of documents and the startup message. */
   /*======================================================*/
   
   CountAppFiles(&theMessage,&nDocs);
   
   /*=================================================*/
   /* If the user chose Print in Finder, then post an */
   /* alert indicating that printing from the Finder  */
   /* is not supported and return to the Finder.      */
   /*=================================================*/
   
   if (theMessage == appPrint)
     {
      StopAlert(CantPrintID,NULL);
      ExitToShell();
     }
     
   /*====================================================*/
   /* Else if the user selected one or documents then... */
   /*====================================================*/
   
   else if (nDocs > 0)
     {
      /*=====================================*/
      /* Loop through each of the documents. */
      /*=====================================*/
      
      for (thisDoc = 1 ; thisDoc <= nDocs; thisDoc++)
        {
         /*===============================================*/
         /* Get the startup information for the document. */
         /*===============================================*/
         
         GetAppFiles(thisDoc,&docInfo);
         
         /*===================================================*/
         /* If the document is a text file, then read it into */
         /* a window and tell the finder that the document    */
         /* has been processed.                               */
         /*===================================================*/
         
         if (docInfo.fType == 'TEXT')
           {
            OpenFile(docInfo.fName,docInfo.vRefNum);
            ClrAppFiles(thisDoc);
           }
           
         /*=================================================*/
         /* Else substitute the document name into the text */
         /* of an alert indicating that the document is of  */
         /* the wrong type and post the alert.              */
         /*=================================================*/
         
         else
           {
            ParamText(docInfo.fName,"\p","\p","\p");
            StopAlert(WrongTypeID,NULL);
           }
        }
     }
  }