added Info.plist
[TestXSLT.git] / libsablot / src / engine / error.cpp
1 /* 
2  * The contents of this file are subject to the Mozilla Public
3  * License Version 1.1 (the "License"); you may not use this file
4  * except in compliance with the License. You may obtain a copy of
5  * the License at http://www.mozilla.org/MPL/
6  * 
7  * Software distributed under the License is distributed on an "AS
8  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9  * implied. See the License for the specific language governing
10  * rights and limitations under the License.
11  * 
12  * The Original Code is the Sablotron XSLT Processor.
13  * 
14  * The Initial Developer of the Original Code is Ginger Alliance Ltd.
15  * Portions created by Ginger Alliance are Copyright (C) 2000-2002
16  * Ginger Alliance Ltd. All Rights Reserved.
17  * 
18  * Contributor(s):
19  * 
20  * Alternatively, the contents of this file may be used under the
21  * terms of the GNU General Public License Version 2 or later (the
22  * "GPL"), in which case the provisions of the GPL are applicable 
23  * instead of those above.  If you wish to allow use of your 
24  * version of this file only under the terms of the GPL and not to
25  * allow others to use your version of this file under the MPL,
26  * indicate your decision by deleting the provisions above and
27  * replace them with the notice and other provisions required by
28  * the GPL.  If you do not delete the provisions above, a recipient
29  * may use your version of this file under either the MPL or the
30  * GPL.
31  */
32
33 //#include <iostream.h>
34 #include <assert.h>
35 #include "error.h"
36
37 // GP: clean
38
39 SabMsg SablotMessages[] = 
40 {
41     {E_OK, "OK"},
42     {E_NOT_OK, "error"},
43     {E_XML, "XML parser error %s: %s"}, 
44     {E_FILE_OPEN, "cannot open file '%s'"}, 
45     {E_MEMORY, "out of memory"},
46     {E1_UNSUPP_XSL, "unsupported XSL instruction '%s'"}, 
47     {ET_BAD_XSL, "non-XSL instruction"}, 
48     {ET_REQ_ATTR, "missing required XSLT attribute"}, 
49     {ET_BAD_ATTR, "unexpected attribute '%s'"},
50     {E1_UNKNOWN_AXIS, "unknown axis '%s'"}, 
51     {ET_EXPR_SYNTAX, "wrong expression syntax"}, 
52     {ET_BAD_NUMBER, "number in bad format"}, 
53     {ET_BAD_VAR, "bad variable"},
54     {ET_INFINITE_LITERAL, "infinite literal"},
55     {ET_LPAREN_EXP, "'(' expected"}, 
56     {ET_RPAREN_EXP, "')' expected"}, 
57     {ET_LPARCKET_EXP, "'(' or '[' expected"}, 
58     {ET_RBRACKET_EXP, "']' expected"}, 
59     {ET_EMPTY_PATT, "pattern is empty"}, 
60     {ET_BAD_TOKEN, "token '%s' not recognized"}, 
61     {E_BAD_AXIS_IN_PATTERN, "illegal axis in pattern"},
62     {E_BAD_PATTERN, "invalid pattern"},
63     {E_VAR_IN_MATCH, "match pattern contains a variable reference"},
64     {E1_VAR_NOT_FOUND, "variable '%s' not found"}, 
65     {E1_VAR_CIRCULAR_REF, "circular reference to variable '%s'"},
66     {ET_CONTEXT_FOR_BAD_EXPR, "expression is not a node set"}, 
67     {ET_BAD_ARGS_N, "invalid number of function arguments"},
68     {ET_BAD_ARG_TYPE, "illegal argument type"},
69     {ET_FUNC_NOT_SUPPORTED, "function '%s' not supported"}, 
70     {ET_BAD_PREFIX, "invalid namespace prefix '%s'"}, 
71     {E1_RULE_NOT_FOUND, "called nonexistent rule '%s'"}, 
72     {ET_DUPLICATE_RULE_NAME, "duplicit rule name '%s'"}, 
73     {ET_DUPLICATE_ASET_NAME, "duplicit attribute set name '%s'"}, 
74     {E1_NONEX_ASET_NAME, "nonexistent attribute set name '%s'"}, 
75     {E1_CIRCULAR_ASET_REF, "circular reference to attribute set '%s'"}, 
76     {E1_DUPLICIT_KEY, "duplicit key '%s'"},
77     {E1_KEY_NOT_FOUND, "key '%s' not found"},
78     {E1_FORMAT_DUPLICIT_OPTION, "option '%s' specified twice"},
79     {E1_FORMAT_OPTION_CHAR, "option '%s' must be a single character"},
80     {E1_FORMAT_DUPLICIT_NAME, "duplicit decimal-format name '%s'"},
81     {E1_FORMAT_NOT_FOUND, "decimal-format '%s' not defined"},
82     {E_FORMAT_INVALID, "invalid format string"},
83     {E1_NUMBER_LEVEL, "value '%s' invalid for attribute level of xsl:number"},
84     {E1_NUMBER_LETTER_VALUE, "value '%s' invalid for attribute letter-value of xsl:number"},
85     {E1_CIRCULAR_INCLUSION, "circular inclusion of '%s'"},
86     {E1_MULT_ASSIGNMENT, "conflicting variable bindings '%s'"},
87     {E1_EXTRA_COLON, "name '%s' contains two colons"},
88     {E_ELEM_MUST_EMPTY, "XSL element '%s' must be empty"},
89     {E_ELEM_CONT_TEXT_OR_LRE, "XSL element '%s' can only contain XSL elements"},
90     {E_ELEM_CONTAINS_ELEM, "XSL element '%s' cannot contain element '%s' at this point"},
91     {E_ELEM_MUST_BE_PCDATA, "XSL element '%s' must contain PCDATA only"},
92     {E1_ELEM_TOPLEVEL, "XSL element '%s' can only be used at the top level"},
93     {E_BAD_ELEM_CONTENT, "bad element content"},
94     {E1_UNSUPPORTED_SCHEME, "unsupported URI scheme '%s'"},
95     {E1_URI_OPEN, "could not open document '%s'"},
96     {E1_URI_CLOSE, "could not close document '%s'"},
97     {E1_URI_READ, "cannot read from URI '%s'"},
98     {E1_URI_WRITE, "cannot write to URI '%s'"},
99     {E1_ARG_NOT_FOUND,"'arg:%s' not found"},
100     {E1_DUPLICATE_ARG, "duplicit argument '%s'"},
101     {E1_ATTR_YES_NO, "attribute '%s' may only have a yes/no value"},
102     {E1_ATTRIBUTE_TOO_LATE, "attribute '%s' created after a child has been added"},
103     {E1_ATTRIBUTE_OUTSIDE, "attribute '%s' created with no parent element"},
104     {E1_BAD_CHAR_IN_ENC, "character '%s' is illegal in the output encoding"},
105     {E1_BAD_CHAR, "illegal character for encoding '%s'"},
106     {E1_PI_TARGET, "invalid processing instruction target '%s'"},
107     {E_ELEM_IN_COMMENT_PI, "element created inside a comment, processing instruction or attribute"},
108     {E1_INVALID_HLR_TYPE, "invalid handler type '%s'"},
109     {E1_XSL_MESSAGE_TERM, "xsl:message (%s) - terminating"},
110     {E1_UNKNOWN_ENC, "unknown encoding '%s'"},
111     
112     {E2_SDOM, "DOM exception %s: %s"},
113     {E_NONE, ""},
114
115     {E_EX_NAMESPACE_UNKNOWN, "excluded prefix '%s' is not bound to any namespace"},
116     {E_INVALID_DATA_IN_PI, "invalid seqence in PI data"},
117
118     {E_UNSUPPORTED_EXELEMENT, "extension element '%s' not supported"},
119     {E_ATTR_MISSING, "required attribute '%s' is missing"},
120     {E_JS_EVAL_ERROR, "error evaluating JavaScript (line: %s; msg: %s)"},
121
122     {E_DUPLICIT_ATTRIBUTE, "duplicit attribute '%s'"},
123     
124     //
125     // warnings
126     //
127     
128     {W_UNSUPP_LANG, "function lang() not supported, returning false"},
129     {W_NO_STYLESHEET, "the included or imported stylesheet '%s' contains "\
130         "no xsl:stylesheet or xsl:transform element"},
131     {W1_HLR_REGISTERED, "conflicting registration of a %s handler ignored"},
132     {W1_HLR_NOT_REGISTERED, "cannot unregister %s handler, none registered"},
133     {W1_OLD_NS_USED, "the obsolete XSLT namespace URI '%s' not recognized"},
134     {W1_XSL_NOT_XSL, "namespace URI '%s' bound to 'xsl' is not the current XSLT URI"},
135     {W1_OUTPUT_ATTR, "conflicting attribute '%s' on xsl:output, using last"},
136     {W_DISABLE_OUTPUT_ESC, "output escaping cannot be disabled on a non-text node"},
137     {W1_UNSUPP_OUT_ENCODING, "output encoding '%s' not supported, using 'UTF-8'"},
138     {W1_UNSUPP_XSL, "ignoring unsupported XSL instruction '%s'"},
139     {W1_XSL_MESSAGE_NOTERM, "xsl:message (%s)"},
140     {W1_SORT_DATA_TYPE, "unknown data type '%s', sorting as text"},
141     {W1_SORT_ORDER, "invalid sort order '%s', using ascending sort"},
142     {W1_SORT_CASE_ORDER, "invalid case order '%s', using default"},
143     {W1_LANG, "unsupported language '%s'"},
144     {W_NO_WCSXFRM, "international sorting unavailable on this system - sorting naively"},
145     {W_BAD_START, "document starts with unrecognized sequence"},
146     {W_NUMBER_GROUPING, "no valid value of attribute grouping-size or grouping-separator of xsl:number -- ignoring"}, 
147     {W_NUMBER_NOT_POSITIVE, "number is not positive -- using absolute value or 1"}, 
148     {W2_ATTSET_REDEF, "attribute '%s' redefined in attribute set '%s'"},
149     {W1_ALIAS_REDEF, "alias '%s' redefinition"},
150     {E_INVALID_QNAME, "'%s' is not a valid QName"},
151     {E_INVALID_NCNAME, "'%s' is not a valid NCName"},
152     {E_DOC_FRAGMENT, "Fragment identifiers are not supported in the document() function (uri: '%s')"},
153     {E_INVALID_OPERAND_TYPE, "Invalid operand type in comparison"},
154     {W_NONE, ""},
155     
156     //
157     // log messages
158     //
159     
160     {L_START, "\n--------starting processing: %s"},
161     {L_STOP, "\n--------stopping: %s"},
162     {L1_PARSING, "Parsing '%s'..."},
163     {L1_PARSE_DONE, "Parse done in %s seconds"},
164     {L1_EXECUTING, "Executing stylesheet '%s'..."},
165     {L1_EXECUTION_DONE, "Execution done in %s seconds"},
166 //    {L1_OUTPUTTING, "Outputting the result using '%s' method..."},
167 //    {L1_OUTPUT_DONE, "Output done in %s seconds"},
168     {L1_READING_EXT_ENTITY, "Parsing an external entity from '%s'"},
169     {L2_DISP_ARENA, "Destroying the arena: %s B asked, %s B allocated"},
170     {L2_DISP_HASH, "Destroying the hash table: %s items in %s buckets"},
171     {L2_KEY_ADDED, "%s items in key '%s'"},
172     {L2_SUBDOC, "creating subsidiary document '%s' with base '%s'"},
173     {L2_SUBDOC_BASE, "defaulting base uri for '%s' to '%s'"},
174     {L2_SUBDOC_STARTED, "catching output for uri '%s' in the '%s' mode"},
175     {L_JS_LOG, "js-debug: %s"},
176     {L_NONE, ""},
177     //debugger specials
178     {DBG_BREAK_PROCESSOR, "interrupted in debugger"},
179     //
180     {MSG_ERROR, "Error"},
181     {MSG_WARNING, "Warning"},
182     {MSG_LOG,"Log message"},
183
184     {MSG_LAST, ""}
185 };
186
187
188 SabMsg* GetMessage(MsgCode e)
189 {
190     SabMsg *p = SablotMessages;
191     while ((p -> code != e) && (p -> code != MSG_LAST))
192         p++;
193     return p;
194 }