~ubuntu-branches/ubuntu/saucy/emscripten/saucy-proposed

« back to all changes in this revision

Viewing changes to tests/freealut/src/alutError.c

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "alutInternal.h"
 
2
#include <stdio.h>
 
3
 
 
4
static ALenum lastError = ALUT_ERROR_NO_ERROR;
 
5
 
 
6
void _alutSetError(ALenum err)
 
7
{
 
8
  /* print a message to stderr if ALUT_DEBUG environment variable is defined */
 
9
  if (getenv("ALUT_DEBUG"))
 
10
  {
 
11
    fprintf(stderr, "ALUT error: %s\n", alutGetErrorString(err));
 
12
  }
 
13
 
 
14
  if (lastError == ALUT_ERROR_NO_ERROR)
 
15
  {
 
16
    lastError = err;
 
17
  }
 
18
}
 
19
 
 
20
ALenum alutGetError(void)
 
21
{
 
22
  ALint ret = lastError;
 
23
 
 
24
  lastError = ALUT_ERROR_NO_ERROR;
 
25
  return ret;
 
26
}
 
27
 
 
28
const char *alutGetErrorString(ALenum error)
 
29
{
 
30
  switch (error)
 
31
  {
 
32
  case ALUT_ERROR_NO_ERROR:
 
33
    return "No ALUT error found";
 
34
 
 
35
  case ALUT_ERROR_OUT_OF_MEMORY:
 
36
    return "ALUT ran out of memory";
 
37
 
 
38
  case ALUT_ERROR_INVALID_ENUM:
 
39
    return "ALUT was given an invalid enumeration token";
 
40
 
 
41
  case ALUT_ERROR_INVALID_VALUE:
 
42
    return "ALUT was given an invalid value";
 
43
 
 
44
  case ALUT_ERROR_INVALID_OPERATION:
 
45
    return "The operation was invalid in the current ALUT state";
 
46
 
 
47
  case ALUT_ERROR_NO_CURRENT_CONTEXT:
 
48
    return "There is no current AL context";
 
49
 
 
50
  case ALUT_ERROR_AL_ERROR_ON_ENTRY:
 
51
    return "There was already an AL error on entry to an ALUT function";
 
52
 
 
53
  case ALUT_ERROR_ALC_ERROR_ON_ENTRY:
 
54
    return "There was already an ALC error on entry to an ALUT function";
 
55
 
 
56
  case ALUT_ERROR_OPEN_DEVICE:
 
57
    return "There was an error opening the ALC device";
 
58
 
 
59
  case ALUT_ERROR_CLOSE_DEVICE:
 
60
    return "There was an error closing the ALC device";
 
61
 
 
62
  case ALUT_ERROR_CREATE_CONTEXT:
 
63
    return "There was an error creating an ALC context";
 
64
 
 
65
  case ALUT_ERROR_MAKE_CONTEXT_CURRENT:
 
66
    return "Could not change the current ALC context";
 
67
 
 
68
  case ALUT_ERROR_DESTROY_CONTEXT:
 
69
    return "There was an error destroying the ALC context";
 
70
 
 
71
  case ALUT_ERROR_GEN_BUFFERS:
 
72
    return "There was an error generating an AL buffer";
 
73
 
 
74
  case ALUT_ERROR_BUFFER_DATA:
 
75
    return "There was an error passing buffer data to AL";
 
76
 
 
77
  case ALUT_ERROR_IO_ERROR:
 
78
    return "I/O error";
 
79
 
 
80
  case ALUT_ERROR_UNSUPPORTED_FILE_TYPE:
 
81
    return "Unsupported file type";
 
82
 
 
83
  case ALUT_ERROR_UNSUPPORTED_FILE_SUBTYPE:
 
84
    return "Unsupported mode within an otherwise usable file type";
 
85
 
 
86
  case ALUT_ERROR_CORRUPT_OR_TRUNCATED_DATA:
 
87
    return "The sound data was corrupt or truncated";
 
88
 
 
89
  default:
 
90
    return "An impossible ALUT error condition was reported?!?";
 
91
  }
 
92
}