1 /////////////////////////////////////////////////////////////////////////// 2 // Copyright (c) 2013 Academy of Motion Picture Arts and Sciences 3 // ("A.M.P.A.S."). Portions contributed by others as indicated. 4 // All rights reserved. 5 // 6 // A worldwide, royalty-free, non-exclusive right to copy, modify, create 7 // derivatives, and use, in source and binary forms, is hereby granted, 8 // subject to acceptance of this license. Performance of any of the 9 // aforementioned acts indicates acceptance to be bound by the following 10 // terms and conditions: 11 // 12 // * Copies of source code, in whole or in part, must retain the 13 // above copyright notice, this list of conditions and the 14 // Disclaimer of Warranty. 15 // 16 // * Use in binary form must retain the above copyright notice, 17 // this list of conditions and the Disclaimer of Warranty in the 18 // documentation and/or other materials provided with the distribution. 19 // 20 // * Nothing in this license shall be deemed to grant any rights to 21 // trademarks, copyrights, patents, trade secrets or any other 22 // intellectual property of A.M.P.A.S. or any contributors, except 23 // as expressly stated herein. 24 // 25 // * Neither the name "A.M.P.A.S." nor the name of any other 26 // contributors to this software may be used to endorse or promote 27 // products derivative of or based on this software without express 28 // prior written permission of A.M.P.A.S. or the contributors, as 29 // appropriate. 30 // 31 // This license shall be construed pursuant to the laws of the State of 32 // California, and any disputes related thereto shall be subject to the 33 // jurisdiction of the courts therein. 34 // 35 // Disclaimer of Warranty: THIS SOFTWARE IS PROVIDED BY A.M.P.A.S. AND 36 // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 37 // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS 38 // FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT ARE DISCLAIMED. IN NO 39 // EVENT SHALL A.M.P.A.S., OR ANY CONTRIBUTORS OR DISTRIBUTORS, BE LIABLE 40 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, RESITUTIONARY, 41 // OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 42 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 43 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 44 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 45 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 46 // THE POSSIBILITY OF SUCH DAMAGE. 47 // 48 // WITHOUT LIMITING THE GENERALITY OF THE FOREGOING, THE ACADEMY 49 // SPECIFICALLY DISCLAIMS ANY REPRESENTATIONS OR WARRANTIES WHATSOEVER 50 // RELATED TO PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS IN THE ACADEMY 51 // COLOR ENCODING SYSTEM, OR APPLICATIONS THEREOF, HELD BY PARTIES OTHER 52 // THAN A.M.P.A.S., WHETHER DISCLOSED OR UNDISCLOSED. 53 /////////////////////////////////////////////////////////////////////////// 54 55 56 #ifndef INCLUDED_CTL_ERRORS_H 57 #define INCLUDED_CTL_ERRORS_H 58 59 //----------------------------------------------------------------------------- 60 // 61 // Compile errors for the color transformation language. 62 // 63 //----------------------------------------------------------------------------- 64 65 namespace Ctl { 66 67 68 enum Error 69 { 70 ERR_AT_SYNTAX = 0, // array out of range 71 ERR_FLOAT_SYNTAX = 1, // invalid floating-point literal 72 ERR_INT_SYNTAX = 2, // invalid int literal 73 ERR_STRING_SYNTAX = 3, // string parsing error 74 ERR_SYNTAX = 4, // general syntax error 75 76 ERR_RETURN_REQ = 5, // Non-void function must return value 77 ERR_RETURN_CONV = 6, // Can't convert return val 78 ERR_FUNC_PARAM = 7, // can't convert func parameter 79 ERR_CONST = 8, // No value given for const 80 81 ERR_ARR_INIT_CONV = 9, // cannot convert initial value for array 82 ERR_ARR_LEN = 10, // cannot determine array length 83 ERR_ARR_IND = 11, // non-integer array size 84 ERR_ARR_SIZE = 12, // invalid array size 85 ERR_ARR_SZ_UNKNOWN= 13, // array size unkown 86 ERR_ARR_IND_TYPE = 14, // non integer index 87 ERR_ARR_EL_TYPE = 15, // wrong type array element 88 89 ERR_NON_ARR_IND = 16, // applied [] operator to non-array 90 91 ERR_INIT_TYPE = 17, // cannot convert init value to type 92 ERR_OP_TYPE = 18, // invalid operand type 93 ERR_TYPE = 19, // can not cast value to requied type 94 95 ERR_LVAL = 20, // lhs of assignment is not lvalue 96 ERR_ASSIGN_CONV = 21, // rhs can not be casted to lhs 97 ERR_IF_CONV = 22, // can't convert condition for 'if' to bool. 98 ERR_WHILE_CONV = 23, // can't convert condition for 'while' to bool. 99 100 ERR_NON_FUNC = 24, // func call to non-function 101 ERR_FUNC_ARG_NUM = 25, // too many function arguments 102 ERR_FUNC_ARG_LVAL = 26, // output func not an lval 103 ERR_FUNC_ARG_TYPE = 27, // wrong func arg type 104 105 ERR_NAME_DUP = 28, // duplicate name definition 106 ERR_NAME_UNDEF = 29, // referenced name not defined 107 108 ERR_STRUCT_ARR_LEN= 30, // unspecified len of struct array member 109 ERR_STRUCT_CONST = 31, // tried to declare const struct member 110 111 ERR_UNKNOWN_TYPE = 32, // tried to declare variable using unknown type 112 ERR_MEMBER_NAME = 33, // error parsing member name 113 ERR_NON_STRUCT = 34, // tried to access member of non-struct type 114 ERR_MEMBER_ACCESS = 35, // unable to find member with given name 115 116 ERR_ARR_INIT_READ = 36, // error parsing array initialization 117 118 ERR_PRINT_TYPE = 37, // cannot print expression of given type 119 120 ERR_NON_ARRAY = 38, // applied size() to non-arraytype 121 ERR_SIZE_SYNTAX = 39, // didn't have "()" after size operator 122 123 ERR_DEFAULT_ORDER = 40, // defaults were not the last arguments 124 ERR_DEFAULT_WRITE = 41, // tried to set default on non-input value 125 126 ERR_STATIC_VAR = 42, // attempt to define a static variable 127 128 ERR_DIV_ZERO = 43, // division by zero 129 130 ERR_CTL_VERSION = 44, // unsupported CTL version 131 132 ERR_MAX , 133 }; 134 135 struct LineError 136 { 137 int lineNumber; 138 Error error; 139 140 bool operator < (const LineError &le) const 141 { 142 return (lineNumber == le.lineNumber ? error < le.error : 143 lineNumber < le.lineNumber); 144 } 145 }; 146 147 148 149 } // namespace Ctl 150 151 #endif 152