Ejemplo n.º 1
0
/* Prints a fatal error message and adds file and line number, then terminates. */
int ErrorAt(const char *filename, long line, unsigned long offset, const char *format, ...)
{
	va_list marker;
	POVMSObject msg;
	char localvsbuffer[1024];

	sprintf(localvsbuffer, "%s Error: ", Stage_Names[STAGE_PARSING].stage_name);

	va_start(marker, format);
	vsnprintf(localvsbuffer + strlen(localvsbuffer), 1023 - strlen(localvsbuffer), format, marker);
	va_end(marker);

	CleanupString(localvsbuffer);

	(void)POVMSObject_New(&msg, kPOVObjectClass_FileLoc);
	(void)POVMSUtil_SetString(&msg, kPOVAttrib_FileName, filename);
	(void)POVMSUtil_SetInt(&msg, kPOVAttrib_Line, line);
	(void)POVMSUtil_SetInt(&msg, kPOVAttrib_Column, 0);
	(void)POVMSUtil_SetLong(&msg, kPOVAttrib_FilePosition, offset);

	(void)POVMSUtil_SetString(&msg, kPOVAttrib_EnglishText, localvsbuffer);
	(void)POVMSUtil_SetInt(&msg, kPOVAttrib_Error, 0);
	(void)POVMSMsg_SetupMessage(&msg, kPOVMsgClass_RenderOutput, kPOVMsgIdent_FatalError);
	(void)POVMSMsg_SetDestinationAddress(&msg, FRONTEND_ADDRESS);
	(void)POVMS_Send(POVMS_Render_Context, &msg, NULL, kPOVMSSendMode_NoReply);

	Terminate_Tokenizer(); /* Closes scene file */

	POV_SHELLOUT(FATAL_SHL);

	povray_exit(1);

	return 0;
}
Ejemplo n.º 2
0
void POVMS_Object::SetLong(POVMSType key, POVMSLong value)
{
	int err;

	err = POVMSUtil_SetLong(&data, key, value);
	if(err != kNoErr)
		throw err;
}
Ejemplo n.º 3
0
void POVMS_Object::SetLong(POVMSType key, POVMSLong value)
{
    int err;

    err = POVMSUtil_SetLong(&data, key, value);
    if(err != pov_base::kNoErr)
        throw POV_EXCEPTION_CODE(err);
}
Ejemplo n.º 4
0
void MessageFactory::WarningAt(unsigned int level, const UCS2 *filename, POV_LONG line, POV_LONG column, POV_LONG offset, const char *format, ...)
{
	va_list marker;
	POVMSObject msg;
	char localvsbuffer[1024];

	sprintf(localvsbuffer, "%s Warning: ", stageName);

	va_start(marker, format);
	vsnprintf(localvsbuffer + strlen(localvsbuffer), 1023 - strlen(localvsbuffer), format, marker);
	va_end(marker);

	CleanupString(localvsbuffer);

	if((warningLevel < 5) || ((warningLevel < 10) && (level == 0)))
		return;

	if(level >= languageVersion)
		return;

	(void)POVMSObject_New(&msg, kPOVObjectClass_ControlData);
	(void)POVMSUtil_SetUCS2String(&msg, kPOVAttrib_FileName, filename);
	(void)POVMSUtil_SetLong(&msg, kPOVAttrib_Line, line);
	(void)POVMSUtil_SetLong(&msg, kPOVAttrib_Column, column);
	(void)POVMSUtil_SetLong(&msg, kPOVAttrib_FilePosition, offset);

	(void)POVMSUtil_SetString(&msg, kPOVAttrib_EnglishText, localvsbuffer);
	(void)POVMSUtil_SetInt(&msg, kPOVAttrib_Warning, 0);

	if(viewId != 0)
		(void)POVMSUtil_SetInt(&msg, kPOVAttrib_ViewId, viewId);
	else
		(void)POVMSUtil_SetInt(&msg, kPOVAttrib_SceneId, sceneId);

	if(viewId != 0)
		(void)POVMSMsg_SetupMessage(&msg, kPOVMsgClass_ViewOutput, kPOVMsgIdent_Warning);
	else
		(void)POVMSMsg_SetupMessage(&msg, kPOVMsgClass_SceneOutput, kPOVMsgIdent_Warning);

	(void)POVMSMsg_SetSourceAddress(&msg, sourceAddress);
	(void)POVMSMsg_SetDestinationAddress(&msg, destinationAddress);

	(void)POVMS_Send(NULL, &msg, NULL, kPOVMSSendMode_NoReply);
}
Ejemplo n.º 5
0
int AddOIStatistic(POVMSAttributeListPtr list, int index, COUNTER *pstats)
{
   POVMSObject obj;
   int err;

   err = POVMSObject_New(&obj, kPOVObjectClass_OIStat);
   if(err == kNoErr)
      err = POVMSUtil_SetString(&obj, kPOVAttrib_ObjectName, intersection_stats[index].infotext);
   if(err == kNoErr)
      err = POVMSUtil_SetInt(&obj, kPOVAttrib_ObjectID, intersection_stats[index].povms_id);
   if(err == kNoErr)
      err = POVMSUtil_SetLong(&obj, kPOVAttrib_ISectsTests, pstats[intersection_stats[index].stat_test_id]);
   if(err == kNoErr)
      err = POVMSUtil_SetLong(&obj, kPOVAttrib_ISectsSucceeded, pstats[intersection_stats[index].stat_suc_id]);
   if(err == kNoErr)
      err = POVMSAttrList_Append(list, &obj);

   return err;
}
Ejemplo n.º 6
0
// filename defaults to NULL, and line, column, and offset default to -1
std::string MessageFactory::SendError(const char *format, va_list arglist, const UCS2 *filename, POV_LONG line, POV_LONG column, POV_LONG offset)
{
	POVMSObject msg;
	char localvsbuffer[1024];

	sprintf(localvsbuffer, "%s Error: ", stageName);
	vsnprintf(localvsbuffer + strlen(localvsbuffer), 1023 - strlen(localvsbuffer), format, arglist);
	CleanupString(localvsbuffer);

	(void)POVMSObject_New(&msg, kPOVObjectClass_ControlData);
	if (filename != NULL)
		(void)POVMSUtil_SetUCS2String(&msg, kPOVAttrib_FileName, filename);
	if (line != -1)
		(void)POVMSUtil_SetLong(&msg, kPOVAttrib_Line, line);
	if (column != -1)
		(void)POVMSUtil_SetLong(&msg, kPOVAttrib_Column, column);
	if (offset != -1)
		(void)POVMSUtil_SetLong(&msg, kPOVAttrib_FilePosition, offset);
	(void)POVMSUtil_SetString(&msg, kPOVAttrib_EnglishText, localvsbuffer);
	(void)POVMSUtil_SetInt(&msg, kPOVAttrib_Error, 0);

	if(viewId != 0)
	{
		(void)POVMSUtil_SetInt(&msg, kPOVAttrib_ViewId, viewId);
		(void)POVMSMsg_SetupMessage(&msg, kPOVMsgClass_ViewOutput, kPOVMsgIdent_FatalError);
	}
	else
	{
		(void)POVMSUtil_SetInt(&msg, kPOVAttrib_SceneId, sceneId);
		(void)POVMSMsg_SetupMessage(&msg, kPOVMsgClass_SceneOutput, kPOVMsgIdent_FatalError);
	}

	(void)POVMSMsg_SetSourceAddress(&msg, sourceAddress);
	(void)POVMSMsg_SetDestinationAddress(&msg, destinationAddress);

	(void)POVMS_Send(NULL, &msg, NULL, kPOVMSSendMode_NoReply);

	return std::string(localvsbuffer);
}
Ejemplo n.º 7
0
/* Prints a non-fatal error message and adds file and line number */
int WarningAt(unsigned int level, const char *filename, long line, unsigned long offset, const char *format, ...)
{
	va_list marker;
	POVMSObject msg;
	char localvsbuffer[1024];

	sprintf(localvsbuffer, "%s Warning: ", Stage_Names[Stage].stage_name);

	va_start(marker, format);
	vsnprintf(localvsbuffer + strlen(localvsbuffer), 1023 - strlen(localvsbuffer), format, marker);
	va_end(marker);

	CleanupString(localvsbuffer);

	if((opts.Warning_Level < 5) || ((opts.Warning_Level < 10) && (level == 0)))
		return 0;

	if(level >= opts.Language_Version)
		return 0;

	(void)POVMSObject_New(&msg, kPOVObjectClass_FileLoc);
	(void)POVMSUtil_SetString(&msg, kPOVAttrib_FileName, filename);
	(void)POVMSUtil_SetInt(&msg, kPOVAttrib_Line, line);
	(void)POVMSUtil_SetInt(&msg, kPOVAttrib_Column, 0);
	(void)POVMSUtil_SetLong(&msg, kPOVAttrib_FilePosition, offset);

	(void)POVMSUtil_SetString(&msg, kPOVAttrib_EnglishText, localvsbuffer);
	(void)POVMSUtil_SetInt(&msg, kPOVAttrib_Warning, 0);
	(void)POVMSMsg_SetupMessage(&msg, kPOVMsgClass_RenderOutput, kPOVMsgIdent_FatalError);
	(void)POVMSMsg_SetDestinationAddress(&msg, FRONTEND_ADDRESS);
	(void)POVMS_Send(POVMS_Render_Context, &msg, NULL, kPOVMSSendMode_NoReply);

	Do_Cooperate(0);

	return 0;
}
Ejemplo n.º 8
0
int AddStatistic(POVMSObjectPtr msg, POVMSType key, COUNTER *counter)
{
   return POVMSUtil_SetLong(msg, key, *counter);
}
Ejemplo n.º 9
0
int BuildProgress(POVMSObjectPtr msg, int progress)
{
	int ret = kNoErr;
	DBL time_dif;

	STOP_TIME
	time_dif = TIME_ELAPSED

	ret = POVMSUtil_SetInt(msg, kPOVAttrib_TotalTime, int(time_dif));

	switch(progress)
	{
		case kPOVList_Prog_CreatingBoundingSlabs:
			break;
		case kPOVList_Prog_CreatingVistaBuffer:
			break;
		case kPOVList_Prog_CreatingLightBuffers:
			break;
		case kPOVList_Prog_BuildingPhotonMaps:
			(void)POVMSUtil_SetInt(msg, kPOVAttrib_TotalPhotonCount, GetPhotonStat(kPOVAttrib_TotalPhotonCount));
			(void)POVMSUtil_SetInt(msg, kPOVAttrib_ObjectPhotonCount, GetPhotonStat(kPOVAttrib_ObjectPhotonCount));
			(void)POVMSUtil_SetInt(msg, kPOVAttrib_MediaPhotonCount, GetPhotonStat(kPOVAttrib_MediaPhotonCount));
			(void)POVMSUtil_SetInt(msg, kPOVAttrib_PhotonXSamples, GetPhotonStat(kPOVAttrib_PhotonXSamples));
			(void)POVMSUtil_SetInt(msg, kPOVAttrib_PhotonYSamples, GetPhotonStat(kPOVAttrib_PhotonYSamples));
			break;
		case kPOVList_Prog_LoadingPhotonMaps:
			break;
		case kPOVList_Prog_SavingPhotonMaps:
			break;
		case kPOVList_Prog_SortingPhotons:
			(void)POVMSUtil_SetInt(msg, kPOVAttrib_CurrentPhotonCount, GetPhotonStat(kPOVAttrib_CurrentPhotonCount));
			(void)POVMSUtil_SetInt(msg, kPOVAttrib_TotalPhotonCount, GetPhotonStat(kPOVAttrib_TotalPhotonCount));
			break;
		case kPOVList_Prog_ReclaimingMemory:
			break;
		case kPOVList_Prog_WritingINIFile:
			break;
		case kPOVList_Prog_WritingHistogramFile:
			break;
		case kPOVList_Prog_PerformingShelloutCommand:
			break;
		case kPOVList_Prog_ResumingInterruptedTrace:
			break;
		case kPOVList_Prog_ProcessingFrame:
			(void)POVMSUtil_SetInt(msg, kPOVAttrib_CurrentFrame, opts.FrameSeq.FrameNumber - opts.FrameSeq.InitialFrame + 1);
			(void)POVMSUtil_SetInt(msg, kPOVAttrib_FrameCount, opts.FrameSeq.FinalFrame - opts.FrameSeq.InitialFrame + 1);
			(void)POVMSUtil_SetInt(msg, kPOVAttrib_AbsoluteCurFrame, opts.FrameSeq.FrameNumber);
			(void)POVMSUtil_SetFloat(msg, kPOVAttrib_FirstClock, opts.FrameSeq.InitialClock);
			(void)POVMSUtil_SetFloat(msg, kPOVAttrib_CurrentClock, opts.FrameSeq.Clock_Value);
			(void)POVMSUtil_SetFloat(msg, kPOVAttrib_LastClock, opts.FrameSeq.FinalClock);
			break;
		case kPOVList_Prog_Parsing:
			(void)POVMSUtil_SetLong(msg, kPOVAttrib_CurrentToken, Current_Token_Count);
			break;
		case kPOVList_Prog_Displaying:
			break;
		case kPOVList_Prog_Rendering:
			(void)POVMSUtil_SetInt(msg, kPOVAttrib_CurrentLine, Current_Line_Number - opts.First_Line + 1);
			(void)POVMSUtil_SetInt(msg, kPOVAttrib_AbsoluteCurrentLine, Current_Line_Number);
			(void)POVMSUtil_SetInt(msg, kPOVAttrib_LineCount, opts.Last_Line - opts.First_Line);
			if(MosaicPreviewSize > 1)
				(void)POVMSUtil_SetInt(msg, kPOVAttrib_MosaicPreviewSize, MosaicPreviewSize);
			else
			{
				if(opts.Options & ANTIALIAS)
					(void)POVMSUtil_SetInt(msg, kPOVAttrib_SuperSampleCount, SuperSampleCount);
				if(opts.Radiosity_Enabled)
					(void)POVMSUtil_SetInt(msg, kPOVAttrib_RadGatherCount, ra_gather_count - RadiosityCount);
			}
			break;
		case kPOVList_Prog_DoneTracing:
			break;
		case kPOVList_Prog_AbortingRender:
			break;
		case kPOVList_Prog_UserAbort:
			break;
	}

	return ret;
}