/**********************************************************************
 
	Copyright (C) 2003 Hirohisa MORI <joshua@nichibun.ac.jp>
 
	This program is free software; you can redistribute it 
	and/or modify it under the terms of the GLOBALBASE 
	Library General Public License (G-LGPL) as published by 

	http://www.globalbase.org/
 
	This program is distributed in the hope that it will be 
	useful, but WITHOUT ANY WARRANTY; without even the 
	implied warranty of MERCHANTABILITY or FITNESS FOR A 
	PARTICULAR PURPOSE.

**********************************************************************/



#include	<stdio.h>
#include	"log.h"
#if !__MACH__
#undef _MSL_BEGIN_EXTERN_C
#undef _MSL_END_EXTERN_C
#define _MSL_BEGIN_EXTERN_C
#define _MSL_END_EXTERN_C
#include	<SIOUX.h>
#endif

#include	"utils.h"
void DisplayAlert(char *msg);

void
er_panic(char * str)
{
char err_msg[512];
	fprintf(stderr,"\n**** PANIC ****\n%s\n***************\n",str);
	snprintf(err_msg, sizeof(err_msg), "*** PANIC ***\r%s\r\rPlease report this error; COSMOS will quit.",str);
	log_printf(LOG_SYSTEM,LOG_LAYER_LIB,0,"%s",str);
	DisplayAlert(err_msg);
#if !__MACH__
	SIOUXSettings.asktosaveonclose = true;
#endif
	exit(1);
}


void
er_panic_x(char * str)
{
char err_msg[512];
	fprintf(stderr,"\n**** PANIC ****\n%s\n***************\n",str);
	snprintf(err_msg, sizeof(err_msg), "*** PANIC ***\r%s\r\rPlease report this error; COSMOS will quit.",str);
	DisplayAlert(err_msg);
	DisplayAlert(str);
#if !__MACH__
	SIOUXSettings.asktosaveonclose = true;
#endif
	exit(1);
}

