Example #1
0
File: error.c Project: E-LLP/QuIP
void _log_message(QSP_ARG_DECL  const char *msg)
{
	const char *log_time;

	log_time = get_date_string(SINGLE_QSP_ARG);

	if( HAS_PREV_LOG_MSG(THIS_QSP) ){
		if( !strcmp(msg,PREV_LOG_MSG(THIS_QSP)) ){
			INCREMENT_LOG_MSG_COUNT(THIS_QSP);
			return;
		} else {
			unsigned long c;
			if( (c=LOG_MSG_COUNT(THIS_QSP)) > 1 ){
				sprintf(ERROR_STRING,
"%s:  previous message was repeated %ld time%s", log_time,c-1,c==2?"":"s");
				advise(ERROR_STRING);
			}
		}
		rls_str(PREV_LOG_MSG(THIS_QSP));
	} else {
		SET_QS_FLAG_BITS(THIS_QSP,QS_HAS_PREV_LOG_MSG);
	}
	sprintf(ERROR_STRING,"%s:  %s", log_time,msg);
	advise(ERROR_STRING);
	SET_PREV_LOG_MSG(THIS_QSP,savestr(msg));
	SET_LOG_MSG_COUNT(THIS_QSP,1);
}
Example #2
0
static void relinquish_to_ios(SINGLE_QSP_ARG_DECL)
{
	// We halt the interpreter to let ios take over
	// and do whatever, using the same mechanism we
	// use for alerts.  In the case of alerts, however,
	// the users dismissal of the alert serves to send
	// control back to the interpreter.  Here, on the other
	// hand, we don't know if anything at all is going to happen
	// (although it probably will, given that this will
	// be called when the script executes os/events).
	//
	// We set a timer based on the display refresh to wake up
	// the interpreter...

	// If this assertion fails, that means that we've
	// already called this?
	assert( ! IS_HALTING( THIS_QSP ) );

	SET_QS_FLAG_BITS(THIS_QSP,QS_HALTING);

	// Now the interpreter will stop reading input.
	// But we now need to schedule a wakeup so that it can pick up
	// again after the OS has done it's stuff...

	sync_with_ios();
}
Example #3
0
File: error.c Project: E-LLP/QuIP
static int silent(SINGLE_QSP_ARG_DECL)
{
	char *s;

	if( ! SILENCE_CHECKED(THIS_QSP) ){
		SET_QS_FLAG_BITS(THIS_QSP,QS_SILENCE_CHECKED);
		s=getenv("SILENT");
		if( s == NULL )
			CLEAR_QS_FLAG_BITS(THIS_QSP,QS_SILENT);
		else {
			if( *s == '0' )
				CLEAR_QS_FLAG_BITS(THIS_QSP,QS_SILENT);
			else
				SET_QS_FLAG_BITS(THIS_QSP,QS_SILENT);
		}
	}
	return( IS_SILENT(THIS_QSP) );
}