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/
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.
12 * The Original Code is the Sablotron XSLT Processor.
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.
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
39 #define Err(situation, code) { if (situation) { situation->error(code, (char*) NULL, (char*) NULL); return NOT_OK; } }
40 #define Err1(situation, code, arg1) { if (situation) { situation->error(code, arg1, (char*) NULL); return NOT_OK; } }
41 #define Err2(situation, code, arg1, arg2) { if (situation) { situation->error(code, arg1, arg2); return NOT_OK; } }
44 #define Err(sit, code) \
45 { report(sit, MT_ERROR, code, (char*)NULL, (char*)NULL); return NOT_OK; }
46 #define Err1(sit, code, arg1) \
47 { report(sit, MT_ERROR, code, arg1, (char*)NULL); return NOT_OK; }
48 #define Err2(sit, code, arg1, arg2) \
49 { report(sit, MT_ERROR, code, arg1, arg2); return NOT_OK; }
51 #define ErrT(obj, sit, code) \
52 { obj -> report(sit, MT_ERROR, code, (char*)NULL, (char*)NULL); return NOT_OK; }
53 #define Err1T(obj, sit, code, arg1) \
54 { obj -> report(sit, MT_ERROR, code, arg1, (char*)NULL); return NOT_OK; }
55 #define Err2T(obj, sit, code, arg1, arg2) \
56 { obj -> report(sit, MT_ERROR, code, arg1, arg2); return NOT_OK; }
58 #define E(statement) {if (statement) return NOT_OK;}
59 #define E_DO(statement, onExit) {if (statement) {{onExit;}; return NOT_OK;}}
61 // the memory allocation checking macro
62 // use as M( newInstance = new SomeClass );
63 #define M( sit, ptr ) {if (!(ptr)) Err(sit, E_MEMORY);}
64 #define MT( obj, sit, ptr ) {if (!(ptr)) ErrT(obj, sit, E_MEMORY);}
66 #define Warn(sit, code) \
67 report(sit, MT_WARN, code, (char*)NULL, (char*)NULL);
68 #define Warn1(sit, code, arg1) \
69 report(sit, MT_WARN, code, arg1, (char*)NULL);
70 #define Warn2(sit, code, arg1, arg2) \
71 report(sit, MT_WARN, code, arg1, arg2);
72 #define Log(sit, code) \
73 report(sit, MT_LOG, code, (char*)NULL, (char*)NULL);
74 #define Log1(sit, code, arg1) \
75 report(sit, MT_LOG, code, arg1, (char*)NULL);
76 #define Log2(sit, code, arg1, arg2) \
77 report(sit, MT_LOG, code, arg1, arg2);
93 // expat parsing error
95 // bad char for encoding '...'
98 // resource allocation
102 // not enough memory to open processor
107 // unsupported XSL instruction
109 // nonexistent XSL instruction
111 // missing required attribute
113 // unexpected attribute
117 // general expression syntax error
119 // number in bad format
121 // illegal variable name
123 // missing right delimiter of a literal
129 // '(' or '[' expected
135 // token not recognized
137 // patterns allow only several axes
138 E_BAD_AXIS_IN_PATTERN,
141 // variable in match att
143 // invalid namespace prefix
145 // name contains 2 colons
147 // this XSLT element must be empty
149 // element can only contain XSLT elements
150 E_ELEM_CONT_TEXT_OR_LRE,
151 // element cannot contain this element at this point
152 E_ELEM_CONTAINS_ELEM,
153 //element must contain PCDATA only
154 E_ELEM_MUST_BE_PCDATA,
155 // element can only be used at top level
157 // bad element content
160 // XSLT stylesheet compilation
162 // duplicit rule name
163 ET_DUPLICATE_RULE_NAME,
164 //duplicit attribute set name
165 ET_DUPLICATE_ASET_NAME,
167 E1_CIRCULAR_ASET_REF,
168 // name contains 2 colons
169 // E1_EXTRA_COLON, (above)
170 // number in bad format
171 // ET_BAD_NUMBER, (above)
174 // non-existent key name
177 // decimal-format related:
179 // option specified twice
180 E1_FORMAT_DUPLICIT_OPTION,
182 // option value must be char
183 E1_FORMAT_OPTION_CHAR,
185 // decimal-format name conflict
186 E1_FORMAT_DUPLICIT_NAME,
188 // decimal-format not defined
191 // invalid format string
194 // xsl:number related:
195 // invalid value of @level:
197 // invalid value of @letter-value:
198 E1_NUMBER_LETTER_VALUE,
200 // circular include/import/ext entity ref
201 E1_CIRCULAR_INCLUSION,
205 // variable not found
207 // circular var reference
209 // expression is not a node set
210 ET_CONTEXT_FOR_BAD_EXPR,
211 // invalid # of arguments
213 // illegal function argument type
215 // called unsupported function
216 ET_FUNC_NOT_SUPPORTED,
217 // invalid namespace prefix
218 // ET_BAD_PREFIX, (above)
219 // called non-existent rule
221 // conflicting variable bindings (name)
223 // name contains 2 colons
224 // E1_EXTRA_COLON, (above)
225 // must be a yes/no attribute
227 // attribute created after a child was added
228 E1_ATTRIBUTE_TOO_LATE,
229 // attribute with no parent
230 E1_ATTRIBUTE_OUTSIDE,
231 // character '...' is illegal in this encoding (on output)
233 // invalid processing instruction target
235 // element created inside a comment or PI
236 E_ELEM_IN_COMMENT_PI,
237 // terminating xsl:message
242 // can't open document
244 // can't close document
246 // can't read from document
248 // can't write to document
250 // named buffer (arg://...) not found
252 // duplicit named buffer
254 // unsupported URI scheme
255 E1_UNSUPPORTED_SCHEME,
256 // invalid handler type
267 //namespace exclusions
268 E_EX_NAMESPACE_UNKNOWN,
271 E_INVALID_DATA_IN_PI,
274 E_UNSUPPORTED_EXELEMENT,
278 E_DUPLICIT_ATTRIBUTE,
284 // lang() not supported, returning false
286 // included/importe stylesheet is no stylesheet
289 // scheme handler warnings
291 // conflicting handler registration
293 // handler not registered, can't unregister
294 W1_HLR_NOT_REGISTERED,
295 // obsolete XSLT namespace
297 // xsl prefix bound to non-XSLT URI
299 // conflicting attributes on xsl:output
301 // can't disable output escaping on non-text
302 W_DISABLE_OUTPUT_ESC,
303 // unsupported output encoding
304 W1_UNSUPP_OUT_ENCODING,
305 // unsupported XSL instruction
307 // non-terminating xsl:message
308 W1_XSL_MESSAGE_NOTERM,
309 // unknown data type on xsl:sort
311 // invlaid sort order on xsl:sort
313 // invalid case order on xsl:sort
315 // unsupported language on xsl:sort
317 // wcsxfrm unavailable
319 // document starts with unrecognizable sequence
321 // no valid value of @grouping-size or @grouping-seoarator on xsl:number
323 // a non-positive number in xsl:number
324 W_NUMBER_NOT_POSITIVE,
325 // attribute set redefinition
327 // alias redefinition
334 //invalid operand to comparison (usually EX_EXTERNAL)
335 E_INVALID_OPERAND_TYPE,
344 // starting processing
346 // stopping processing
352 // starting execution
354 // execution finished
356 // parsing external entity
357 L1_READING_EXT_ENTITY,
358 // destroying the arena
360 // destroying the hash table
364 //subsidiary document
390 extern SabMsg* GetMessage(MsgCode e);
392 #endif //ifndef ErrorHIncl