w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

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