Path: blob/master/thirdparty/graphite/src/inc/Error.h
9906 views
// SPDX-License-Identifier: MIT OR MPL-2.0 OR LGPL-2.1-or-later OR GPL-2.0-or-later1// Copyright 2013, SIL International, All rights reserved.23#pragma once45// numbers are explicitly assigned for future proofing67namespace graphite28{910class Error11{12public:13Error() : _e(0) {};14operator bool() { return (_e != 0); }15int error() { return _e; }16void error(int e) { _e = e; }17bool test(bool pr, int err) { return (_e = pr ? err : 0); }1819private:20int _e;21};2223enum errcontext {24EC_READGLYPHS = 1, // while reading glyphs25EC_READSILF = 2, // in Silf table26EC_ASILF = 3, // in Silf %d27EC_APASS = 4, // in Silf %d, pass %d28EC_PASSCCODE = 5, // in pass constraint code for Silf %d, pass %d29EC_ARULE = 6, // in Silf %d, pass %d, rule %d30EC_ASTARTS = 7, // in Silf %d, pass %d, start state %d31EC_ATRANS = 8, // in Silf %d, pass %d, fsm state %d32EC_ARULEMAP = 9 // in Silf %d, pass %d, state %d33};3435enum error {36E_OUTOFMEM = 1, // Out of memory37E_NOGLYPHS = 2, // There are no glyphs in the font38E_BADUPEM = 3, // The units per em for the font is bad (0)39E_BADCMAP = 4, // The font does not contain any useful cmaps40E_NOSILF = 5, // Missing Silf table41E_TOOOLD = 6, // Silf table version is too old42E_BADSIZE = 7, // context object has the wrong structural size43// Silf Subtable Errors take a Silf subtable number * 256 in the context44E_BADMAXGLYPH = 8, // Silf max glyph id is too high45E_BADNUMJUSTS = 9, // Number of Silf justification blocks is too high46E_BADENDJUSTS = 10, // Silf justification blocks take too much of the Silf table space47E_BADCRITFEATURES = 11, // Critical features section in a Silf table is too big48E_BADSCRIPTTAGS = 12, // Silf script tags area is too big49E_BADAPSEUDO = 13, // The pseudo glyph attribute number is too high50E_BADABREAK = 14, // The linebreak glyph attribute number is too high51E_BADABIDI = 15, // The bidi glyph attribute number is too high52E_BADAMIRROR = 16, // The mirrored glyph attribute number is too high53E_BADNUMPASSES = 17, // The number of passes is > 12854E_BADPASSESSTART = 18, // The Silf table is too small to hold any passes55E_BADPASSBOUND = 19, // The positioning pass number is too low or the substitution pass number is too high56E_BADPPASS = 20, // The positioning pass number is too high57E_BADSPASS = 21, // the substitution pass number is too high58E_BADJPASSBOUND = 22, // the justification pass must be higher than the positioning pass59E_BADJPASS = 23, // the justification pass is too high60E_BADALIG = 24, // the number of initial ligature component glyph attributes is too high61E_BADBPASS = 25, // the bidi pass number is specified and is either too high or too low62E_BADNUMPSEUDO = 26, // The number of pseudo glyphs is too high63E_BADCLASSSIZE = 27, // The size of the classes block is bad64E_TOOMANYLINEAR = 28, // The number of linear classes in the silf table is too high65E_CLASSESTOOBIG = 29, // There are too many classes for the space allocated in the Silf subtable66E_MISALIGNEDCLASSES = 30, // The class offsets in the class table don't line up with the number of classes67E_HIGHCLASSOFFSET = 31, // The class offsets point out of the class table68E_BADCLASSOFFSET = 32, // A class offset is less than one following it69E_BADCLASSLOOKUPINFO = 33, // The search header info for a non-linear class has wrong values in it70// Pass subtable errors. Context has pass number * 6553671E_BADPASSSTART = 34, // The start offset for a particular pass is bad72E_BADPASSEND = 35, // The end offset for a particular pass is bad73E_BADPASSLENGTH = 36, // The length of the pass is too small74E_BADNUMTRANS = 37, // The number of transition states in the fsm is bad75E_BADNUMSUCCESS = 38, // The number of success states in the fsm is bad76E_BADNUMSTATES = 39, // The number of states in the fsm is bad77E_NORANGES = 40, // There are no columns in the fsm78E_BADRULEMAPLEN = 41, // The size of the success state to rule mapping is bad79E_BADCTXTLENBOUNDS = 42, // The precontext maximum is greater than its minimum80E_BADCTXTLENS = 43, // The lists of rule lengths or pre context lengths is bad81E_BADPASSCCODEPTR = 44, // The pass constraint code position does not align with where the forward reference says it should be82E_BADRULECCODEPTR = 45, // The rule constraint code position does not align with where the forward reference says it should be83E_BADCCODELEN = 46, // Bad rule/pass constraint code length84E_BADACTIONCODEPTR = 47, // The action code position does not align with where the forward reference says it should be85E_MUTABLECCODE = 48, // Constraint code edits slots. It shouldn't.86E_BADSTATE = 49, // Bad state transition referencing an illegal state87E_BADRULEMAPPING = 50, // The structure of the rule mapping is bad88E_BADRANGE = 51, // Bad column range structure including a glyph in more than one column89E_BADRULENUM = 52, // A reference to a rule is out of range (too high)90E_BADACOLLISION = 53, // Bad Silf table collision attribute number (too high)91E_BADEMPTYPASS = 54, // Can't have empty passes (no rules) except for collision passes92E_BADSILFVERSION = 55, // The Silf table has a bad version (probably too high)93E_BADCOLLISIONPASS = 56, // Collision flags set on a non positioning pass94E_BADNUMCOLUMNS = 57, // Arbitrarily limit number of columns in fsm95// Code errors96E_CODEFAILURE = 60, // Base code error. The following subcodes must align with Machine::Code::status_t in Code.h97E_CODEALLOC = 61, // Out of memory98E_INVALIDOPCODE = 62, // Invalid op code99E_UNIMPOPCODE = 63, // Unimplemented op code encountered100E_OUTOFRANGECODE = 64, // Code argument out of range101E_BADJUMPCODE = 65, // Code jumps past end of op codes102E_CODEBADARGS = 66, // Code arguments exhausted103E_CODENORETURN = 67, // Missing return type op code at end of code104E_CODENESTEDCTXT = 68, // Nested context encountered in code105// Compression errors106E_BADSCHEME = 69,107E_SHRINKERFAILED = 70,108};109110}111112113