gfx/graphite2/src/inc/Error.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* GRAPHITE2 LICENSING
michael@0 2
michael@0 3 Copyright 2013, SIL International
michael@0 4 All rights reserved.
michael@0 5
michael@0 6 This library is free software; you can redistribute it and/or modify
michael@0 7 it under the terms of the GNU Lesser General Public License as published
michael@0 8 by the Free Software Foundation; either version 2.1 of License, or
michael@0 9 (at your option) any later version.
michael@0 10
michael@0 11 This program is distributed in the hope that it will be useful,
michael@0 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
michael@0 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
michael@0 14 Lesser General Public License for more details.
michael@0 15
michael@0 16 You should also have received a copy of the GNU Lesser General Public
michael@0 17 License along with this library in the file named "LICENSE".
michael@0 18 If not, write to the Free Software Foundation, 51 Franklin Street,
michael@0 19 Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
michael@0 20 internet at http://www.fsf.org/licenses/lgpl.html.
michael@0 21
michael@0 22 Alternatively, the contents of this file may be used under the terms of the
michael@0 23 Mozilla Public License (http://mozilla.org/MPL) or the GNU General Public
michael@0 24 License, as published by the Free Software Foundation, either version 2
michael@0 25 of the License or (at your option) any later version.
michael@0 26 */
michael@0 27 #pragma once
michael@0 28
michael@0 29 // numbers are explicitly assigned for future proofing
michael@0 30
michael@0 31 namespace graphite2
michael@0 32 {
michael@0 33
michael@0 34 class Error
michael@0 35 {
michael@0 36 public:
michael@0 37 Error() : _e(0) {};
michael@0 38 operator bool() { return (_e != 0); }
michael@0 39 int error() { return _e; }
michael@0 40 void error(int e) { _e = e; }
michael@0 41 bool test(bool pr, int err) { return (_e = int(pr) * err); }
michael@0 42
michael@0 43 private:
michael@0 44 int _e;
michael@0 45 };
michael@0 46
michael@0 47 enum errcontext {
michael@0 48 EC_READGLYPHS = 1, // while reading glyphs
michael@0 49 EC_READSILF = 2, // in Silf table
michael@0 50 EC_ASILF = 3, // in Silf %d
michael@0 51 EC_APASS = 4, // in Silf %d, pass %d
michael@0 52 EC_PASSCCODE = 5, // in pass constraint code for Silf %d, pass %d
michael@0 53 EC_ARULE = 6, // in Silf %d, pass %d, rule %d
michael@0 54 EC_ASTARTS = 7, // in Silf %d, pass %d, start state %d
michael@0 55 EC_ATRANS = 8, // in Silf %d, pass %d, fsm state %d
michael@0 56 EC_ARULEMAP = 9 // in Silf %d, pass %d, state %d
michael@0 57 };
michael@0 58
michael@0 59 enum errors {
michael@0 60 E_OUTOFMEM = 1, // Out of memory
michael@0 61 E_NOGLYPHS = 2, // There are no glyphs in the font
michael@0 62 E_BADUPEM = 3, // The units per em for the font is bad (0)
michael@0 63 E_BADCMAP = 4, // The font does not contain any useful cmaps
michael@0 64 E_NOSILF = 5, // Missing Silf table
michael@0 65 E_TOOOLD = 6, // Silf table version is too old
michael@0 66 E_BADSIZE = 7, // context object has the wrong structural size
michael@0 67 // Silf Subtable Errors take a Silf subtable number * 256 in the context
michael@0 68 E_BADMAXGLYPH = 8, // Silf max glyph id is too high
michael@0 69 E_BADNUMJUSTS = 9, // Number of Silf justification blocks is too high
michael@0 70 E_BADENDJUSTS = 10, // Silf justification blocks take too much of the Silf table space
michael@0 71 E_BADCRITFEATURES = 11, // Critical features section in a Silf table is too big
michael@0 72 E_BADSCRIPTTAGS = 12, // Silf script tags area is too big
michael@0 73 E_BADAPSEUDO = 13, // The pseudo glyph attribute number is too high
michael@0 74 E_BADABREAK = 14, // The linebreak glyph attribute number is too high
michael@0 75 E_BADABIDI = 15, // The bidi glyph attribute number is too high
michael@0 76 E_BADAMIRROR = 16, // The mirrored glyph attribute number is too high
michael@0 77 E_BADNUMPASSES = 17, // The number of passes is > 128
michael@0 78 E_BADPASSESSTART = 18, // The Silf table is too small to hold any passes
michael@0 79 E_BADPASSBOUND = 19, // The positioning pass number is too low or the substitution pass number is too high
michael@0 80 E_BADPPASS = 20, // The positioning pass number is too high
michael@0 81 E_BADSPASS = 21, // the substitution pass number is too high
michael@0 82 E_BADJPASSBOUND = 22, // the justification pass must be higher than the positioning pass
michael@0 83 E_BADJPASS = 23, // the justification pass is too high
michael@0 84 E_BADALIG = 24, // the number of initial ligature component glyph attributes is too high
michael@0 85 E_BADBPASS = 25, // the bidi pass number is specified and is either too high or too low
michael@0 86 E_BADNUMPSEUDO = 26, // The number of pseudo glyphs is too high
michael@0 87 E_BADCLASSSIZE = 27, // The size of the classes block is bad
michael@0 88 E_TOOMANYLINEAR = 28, // The number of linear classes in the silf table is too high
michael@0 89 E_CLASSESTOOBIG = 29, // There are too many classes for the space allocated in the Silf subtable
michael@0 90 E_MISALIGNEDCLASSES = 30, // The class offsets in the class table don't line up with the number of classes
michael@0 91 E_HIGHCLASSOFFSET = 31, // The class offsets point out of the class table
michael@0 92 E_BADCLASSOFFSET = 32, // A class offset is less than one following it
michael@0 93 E_BADCLASSLOOKUPINFO = 33, // The search header info for a non-linear class has wrong values in it
michael@0 94 // Pass subtable errors. Context has pass number * 65536
michael@0 95 E_BADPASSSTART = 34, // The start offset for a particular pass is bad
michael@0 96 E_BADPASSEND = 35, // The end offset for a particular pass is bad
michael@0 97 E_BADPASSLENGTH = 36, // The length of the pass is too small
michael@0 98 E_BADNUMTRANS = 37, // The number of transition states in the fsm is bad
michael@0 99 E_BADNUMSUCCESS = 38, // The number of success states in the fsm is bad
michael@0 100 E_BADNUMSTATES = 39, // The number of states in the fsm is bad
michael@0 101 E_NORANGES = 40, // There are no columns in the fsm
michael@0 102 E_BADRULEMAPLEN = 41, // The size of the success state to rule mapping is bad
michael@0 103 E_BADCTXTLENBOUNDS = 42, // The precontext maximum is greater than its minimum
michael@0 104 E_BADCTXTLENS = 43, // The lists of rule lengths or pre context lengths is bad
michael@0 105 E_BADPASSCCODEPTR = 44, // The pass constraint code position does not align with where the forward reference says it should be
michael@0 106 E_BADRULECCODEPTR = 45, // The rule constraint code position does not align with where the forward reference says it should be
michael@0 107 E_BADCCODELEN = 46, // Bad rule/pass constraint code length
michael@0 108 E_BADACTIONCODEPTR = 47, // The action code position does not align with where the forward reference says it should be
michael@0 109 E_MUTABLECCODE = 48, // Constraint code edits slots. It shouldn't.
michael@0 110 E_BADSTATE = 49, // Bad state transition referencing an illegal state
michael@0 111 E_BADRULEMAPPING = 50, // The structure of the rule mapping is bad
michael@0 112 E_BADRANGE = 51, // Bad column range structure including a glyph in more than one column
michael@0 113 E_BADRULENUM = 52, // A reference to a rule is out of range (too high)
michael@0 114 // Code errors
michael@0 115 E_CODEFAILURE = 60, // Base code error. The following subcodes must align with Machine::Code::status_t in Code.h
michael@0 116 E_CODEALLOC = 61, // Out of memory
michael@0 117 E_INVALIDOPCODE = 62, // Invalid op code
michael@0 118 E_UNIMPOPCODE = 63, // Unimplemented op code encountered
michael@0 119 E_OUTOFRANGECODE = 64, // Code argument out of range
michael@0 120 E_BADJUMPCODE = 65, // Code jumps past end of op codes
michael@0 121 E_CODEBADARGS = 66, // Code arguments exhausted
michael@0 122 E_CODENORETURN = 67, // Missing return type op code at end of code
michael@0 123 E_CODENESTEDCTXT = 68 // Nested context encountered in code
michael@0 124 };
michael@0 125
michael@0 126 }
michael@0 127

mercurial