1
//-----------------------------------------------------------------------------
4
// Copyright (C) 2000-2002 by Denton Woods
5
// Last modified: 05/25/2001 <--Y2K Compliant! =]
7
// Filename: src-IL/src/il_error.c
9
// Description: The error functions
11
//-----------------------------------------------------------------------------
14
#include "il_internal.h"
17
#define IL_ERROR_STACK_SIZE 32 // Needed elsewhere?
20
ILenum ilErrorNum[IL_ERROR_STACK_SIZE];
21
ILint ilErrorPlace = (-1);
24
// Sets the current error
25
// If you go past the stack size for this, it cycles the errors, almost like a LRU algo.
26
ILAPI ILvoid ILAPIENTRY ilSetError(ILenum Error)
31
if (ilErrorPlace >= IL_ERROR_STACK_SIZE) {
32
for (i = 0; i < IL_ERROR_STACK_SIZE - 2; i++) {
33
ilErrorNum[i] = ilErrorNum[i+1];
35
ilErrorPlace = IL_ERROR_STACK_SIZE - 1;
37
ilErrorNum[ilErrorPlace] = Error;
43
//! Gets the last error on the error stack
44
ILenum ILAPIENTRY ilGetError(ILvoid)
48
if (ilErrorPlace >= 0) {
49
ilReturn = ilErrorNum[ilErrorPlace];
53
ilReturn = IL_NO_ERROR;