home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / Sylia / ScriptError.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-14  |  2.6 KB  |  58 lines

  1. #include "ScriptError.h"
  2.  
  3. namespace {
  4.     static struct ErrorEnt {
  5.         int e;
  6.         char *s;
  7.     } error_list[]={
  8.         { VDScriptError::PARSE_ERROR,                    "parse error" },
  9.         { VDScriptError::SEMICOLON_EXPECTED,            "expected ';'" },
  10.         { VDScriptError::IDENTIFIER_EXPECTED,            "identifier expected" },
  11.         { VDScriptError::TYPE_INT_REQUIRED,                "integer type required" },
  12.         { VDScriptError::TYPE_ARRAY_REQUIRED,            "array type required" },
  13.         { VDScriptError::TYPE_FUNCTION_REQUIRED,        "function type required" },
  14.         { VDScriptError::TYPE_OBJECT_REQUIRED,            "object type required" },
  15.         { VDScriptError::OBJECT_MEMBER_NAME_REQUIRED,    "object member name expected" },
  16.         { VDScriptError::FUNCCALLEND_EXPECTED,            "expected ')'" },
  17.         { VDScriptError::TOO_MANY_PARAMS,                "function call parameter limit exceeded" },
  18.         { VDScriptError::DIVIDE_BY_ZERO,                "divide by zero" },
  19.         { VDScriptError::VAR_NOT_FOUND,                    "variable not found" },
  20.         { VDScriptError::MEMBER_NOT_FOUND,                "member not found" },
  21.         { VDScriptError::OVERLOADED_FUNCTION_NOT_FOUND,    "overloaded function not found" },
  22.         { VDScriptError::IDENT_TOO_LONG,                "identifier length limit exceeded" },
  23.         { VDScriptError::OPERATOR_EXPECTED,                "expression operator expected" },
  24.         { VDScriptError::CLOSEPARENS_EXPECTED,            "expected ')'" },
  25.         { VDScriptError::CLOSEBRACKET_EXPECTED,            "expected ']'" },
  26.         { VDScriptError::OUT_OF_STRING_SPACE,            "out of string space" },
  27.         { VDScriptError::OUT_OF_MEMORY,                    "out of memory" },
  28.         { VDScriptError::INTERNAL_ERROR,                "internal error" },
  29.         { VDScriptError::EXTERNAL_ERROR,                "error in external Sylia linkages" },
  30.         { VDScriptError::VAR_UNDEFINED,                    "variable's value is undefined" },
  31.         { VDScriptError::FCALL_OUT_OF_RANGE,            "argument out of range" },
  32.         { VDScriptError::FCALL_INVALID_PTYPE,            "argument has wrong type" },
  33.         { VDScriptError::FCALL_UNKNOWN_STR,                "string argument not recognized" },
  34.         { VDScriptError::ARRAY_INDEX_OUT_OF_BOUNDS,        "array index out of bounds" },
  35.         { VDScriptError::NUMERIC_OVERFLOW,                "numeric overflow" },
  36.         { VDScriptError::STRING_NOT_AN_INTEGER_VALUE,    "string is not an integer number" },
  37.         { VDScriptError::STRING_NOT_A_REAL_VALUE,        "string is not an real number" },
  38.         { VDScriptError::ASSERTION_FAILED,                "assertion failed" },
  39.         { VDScriptError::AMBIGUOUS_CALL,                "ambiguous call to overloaded method" },
  40.         { VDScriptError::CANNOT_CAST,                    "cannot cast to specified type" },
  41.         { 0, 0 },
  42.     };
  43. }
  44.  
  45. const char *VDScriptTranslateError(int e) {
  46.     struct ErrorEnt *eeptr = error_list;
  47.  
  48.     while(eeptr->s) {
  49.         if (eeptr->e == e)
  50.             return eeptr->s;
  51.  
  52.         ++eeptr;
  53.     }
  54.  
  55.     return "unknown error";
  56. }
  57.  
  58.