Annotation of win32/gnome/gnome-xml/include/libxml/parserInternals.h, revision 1.1
1.1 ! paf 1: /*
! 2: * parserInternals.h : internals routines exported by the parser.
! 3: *
! 4: * See Copyright for the status of this software.
! 5: *
! 6: * daniel@veillard.com
! 7: *
! 8: */
! 9:
! 10: #ifndef __XML_PARSER_INTERNALS_H__
! 11: #define __XML_PARSER_INTERNALS_H__
! 12:
! 13: #include <libxml/parser.h>
! 14: #include <libxml/HTMLparser.h>
! 15:
! 16: #ifdef __cplusplus
! 17: extern "C" {
! 18: #endif
! 19:
! 20: /**
! 21: * XML_MAX_NAMELEN:
! 22: *
! 23: * Identifiers can be longer, but this will be more costly
! 24: * at runtime.
! 25: */
! 26: #define XML_MAX_NAMELEN 100
! 27:
! 28: /**
! 29: * INPUT_CHUNK:
! 30: *
! 31: * The parser tries to always have that amount of input ready.
! 32: * One of the point is providing context when reporting errors.
! 33: */
! 34: #define INPUT_CHUNK 250
! 35:
! 36: /************************************************************************
! 37: * *
! 38: * UNICODE version of the macros. *
! 39: * *
! 40: ************************************************************************/
! 41: /**
! 42: * IS_CHAR:
! 43: * @c: an UNICODE value (int)
! 44: *
! 45: * Macro to check the following production in the XML spec:
! 46: *
! 47: * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
! 48: * | [#x10000-#x10FFFF]
! 49: * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
! 50: */
! 51: #define IS_CHAR(c) \
! 52: ((((c) >= 0x20) && ((c) <= 0xD7FF)) || \
! 53: ((c) == 0x09) || ((c) == 0x0A) || ((c) == 0x0D) || \
! 54: (((c) >= 0xE000) && ((c) <= 0xFFFD)) || \
! 55: (((c) >= 0x10000) && ((c) <= 0x10FFFF)))
! 56:
! 57: /**
! 58: * IS_BLANK:
! 59: * @c: an UNICODE value (int)
! 60: *
! 61: * Macro to check the following production in the XML spec:
! 62: *
! 63: * [3] S ::= (#x20 | #x9 | #xD | #xA)+
! 64: */
! 65: #define IS_BLANK(c) (((c) == 0x20) || ((c) == 0x09) || ((c) == 0xA) || \
! 66: ((c) == 0x0D))
! 67:
! 68: /**
! 69: * IS_BASECHAR:
! 70: * @c: an UNICODE value (int)
! 71: *
! 72: * Macro to check the following production in the XML spec:
! 73: *
! 74: * [85] BaseChar ::= ... long list see REC ...
! 75: */
! 76: #define IS_BASECHAR(c) xmlIsBaseChar(c)
! 77:
! 78: /**
! 79: * IS_DIGIT:
! 80: * @c: an UNICODE value (int)
! 81: *
! 82: * Macro to check the following production in the XML spec:
! 83: *
! 84: * [88] Digit ::= ... long list see REC ...
! 85: */
! 86: #define IS_DIGIT(c) xmlIsDigit(c)
! 87:
! 88: /**
! 89: * IS_COMBINING:
! 90: * @c: an UNICODE value (int)
! 91: *
! 92: * Macro to check the following production in the XML spec:
! 93: *
! 94: * [87] CombiningChar ::= ... long list see REC ...
! 95: */
! 96: #define IS_COMBINING(c) xmlIsCombining(c)
! 97:
! 98: /**
! 99: * IS_EXTENDER:
! 100: * @c: an UNICODE value (int)
! 101: *
! 102: * Macro to check the following production in the XML spec:
! 103: *
! 104: *
! 105: * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 |
! 106: * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] |
! 107: * [#x309D-#x309E] | [#x30FC-#x30FE]
! 108: */
! 109: #define IS_EXTENDER(c) xmlIsExtender(c)
! 110:
! 111: /**
! 112: * IS_IDEOGRAPHIC:
! 113: * @c: an UNICODE value (int)
! 114: *
! 115: * Macro to check the following production in the XML spec:
! 116: *
! 117: *
! 118: * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]
! 119: */
! 120: #define IS_IDEOGRAPHIC(c) xmlIsIdeographic(c)
! 121:
! 122: /**
! 123: * IS_LETTER:
! 124: * @c: an UNICODE value (int)
! 125: *
! 126: * Macro to check the following production in the XML spec:
! 127: *
! 128: *
! 129: * [84] Letter ::= BaseChar | Ideographic
! 130: */
! 131: #define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c))
! 132:
! 133:
! 134: /**
! 135: * IS_PUBIDCHAR:
! 136: * @c: an UNICODE value (int)
! 137: *
! 138: * Macro to check the following production in the XML spec:
! 139: *
! 140: *
! 141: * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
! 142: */
! 143: #define IS_PUBIDCHAR(c) xmlIsPubidChar(c)
! 144:
! 145: /**
! 146: * SKIP_EOL:
! 147: * @p: and UTF8 string pointer
! 148: *
! 149: * Skips the end of line chars.
! 150: */
! 151: #define SKIP_EOL(p) \
! 152: if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \
! 153: if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; }
! 154:
! 155: /**
! 156: * MOVETO_ENDTAG:
! 157: * @p: and UTF8 string pointer
! 158: *
! 159: * Skips to the next '>' char.
! 160: */
! 161: #define MOVETO_ENDTAG(p) \
! 162: while ((*p) && (*(p) != '>')) (p)++
! 163:
! 164: /**
! 165: * MOVETO_STARTTAG:
! 166: * @p: and UTF8 string pointer
! 167: *
! 168: * Skips to the next '<' char.
! 169: */
! 170: #define MOVETO_STARTTAG(p) \
! 171: while ((*p) && (*(p) != '<')) (p)++
! 172:
! 173: /**
! 174: * Global variables used for predefined strings.
! 175: */
! 176: LIBXML_DLL_IMPORT extern const xmlChar xmlStringText[];
! 177: LIBXML_DLL_IMPORT extern const xmlChar xmlStringTextNoenc[];
! 178: LIBXML_DLL_IMPORT extern const xmlChar xmlStringComment[];
! 179:
! 180: /*
! 181: * Function to finish the work of the macros where needed.
! 182: */
! 183: int xmlIsBaseChar (int c);
! 184: int xmlIsBlank (int c);
! 185: int xmlIsPubidChar (int c);
! 186: int xmlIsLetter (int c);
! 187: int xmlIsDigit (int c);
! 188: int xmlIsIdeographic(int c);
! 189: int xmlIsExtender (int c);
! 190: int xmlIsCombining (int c);
! 191: int xmlIsChar (int c);
! 192:
! 193: /**
! 194: * Parser context.
! 195: */
! 196: xmlParserCtxtPtr xmlCreateFileParserCtxt (const char *filename);
! 197: xmlParserCtxtPtr xmlCreateMemoryParserCtxt(const char *buffer,
! 198: int size);
! 199: xmlParserCtxtPtr xmlNewParserCtxt (void);
! 200: xmlParserCtxtPtr xmlCreateEntityParserCtxt(const xmlChar *URL,
! 201: const xmlChar *ID,
! 202: const xmlChar *base);
! 203: int xmlSwitchEncoding (xmlParserCtxtPtr ctxt,
! 204: xmlCharEncoding enc);
! 205: int xmlSwitchToEncoding (xmlParserCtxtPtr ctxt,
! 206: xmlCharEncodingHandlerPtr handler);
! 207:
! 208: /**
! 209: * Entities
! 210: */
! 211: void xmlHandleEntity (xmlParserCtxtPtr ctxt,
! 212: xmlEntityPtr entity);
! 213:
! 214: /**
! 215: * Input Streams.
! 216: */
! 217: xmlParserInputPtr xmlNewStringInputStream (xmlParserCtxtPtr ctxt,
! 218: const xmlChar *buffer);
! 219: xmlParserInputPtr xmlNewEntityInputStream (xmlParserCtxtPtr ctxt,
! 220: xmlEntityPtr entity);
! 221: void xmlPushInput (xmlParserCtxtPtr ctxt,
! 222: xmlParserInputPtr input);
! 223: xmlChar xmlPopInput (xmlParserCtxtPtr ctxt);
! 224: void xmlFreeInputStream (xmlParserInputPtr input);
! 225: xmlParserInputPtr xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
! 226: const char *filename);
! 227: xmlParserInputPtr xmlNewInputStream (xmlParserCtxtPtr ctxt);
! 228:
! 229: /**
! 230: * Namespaces.
! 231: */
! 232: xmlChar * xmlSplitQName (xmlParserCtxtPtr ctxt,
! 233: const xmlChar *name,
! 234: xmlChar **prefix);
! 235: xmlChar * xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt);
! 236: xmlChar * xmlNamespaceParseQName (xmlParserCtxtPtr ctxt,
! 237: xmlChar **prefix);
! 238: xmlChar * xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt);
! 239: xmlChar * xmlParseQuotedString (xmlParserCtxtPtr ctxt);
! 240: void xmlParseNamespace (xmlParserCtxtPtr ctxt);
! 241:
! 242: /**
! 243: * Generic production rules.
! 244: */
! 245: xmlChar * xmlScanName (xmlParserCtxtPtr ctxt);
! 246: xmlChar * xmlParseName (xmlParserCtxtPtr ctxt);
! 247: xmlChar * xmlParseNmtoken (xmlParserCtxtPtr ctxt);
! 248: xmlChar * xmlParseEntityValue (xmlParserCtxtPtr ctxt,
! 249: xmlChar **orig);
! 250: xmlChar * xmlParseAttValue (xmlParserCtxtPtr ctxt);
! 251: xmlChar * xmlParseSystemLiteral (xmlParserCtxtPtr ctxt);
! 252: xmlChar * xmlParsePubidLiteral (xmlParserCtxtPtr ctxt);
! 253: void xmlParseCharData (xmlParserCtxtPtr ctxt,
! 254: int cdata);
! 255: xmlChar * xmlParseExternalID (xmlParserCtxtPtr ctxt,
! 256: xmlChar **publicID,
! 257: int strict);
! 258: void xmlParseComment (xmlParserCtxtPtr ctxt);
! 259: xmlChar * xmlParsePITarget (xmlParserCtxtPtr ctxt);
! 260: void xmlParsePI (xmlParserCtxtPtr ctxt);
! 261: void xmlParseNotationDecl (xmlParserCtxtPtr ctxt);
! 262: void xmlParseEntityDecl (xmlParserCtxtPtr ctxt);
! 263: int xmlParseDefaultDecl (xmlParserCtxtPtr ctxt,
! 264: xmlChar **value);
! 265: xmlEnumerationPtr xmlParseNotationType (xmlParserCtxtPtr ctxt);
! 266: xmlEnumerationPtr xmlParseEnumerationType (xmlParserCtxtPtr ctxt);
! 267: int xmlParseEnumeratedType (xmlParserCtxtPtr ctxt,
! 268: xmlEnumerationPtr *tree);
! 269: int xmlParseAttributeType (xmlParserCtxtPtr ctxt,
! 270: xmlEnumerationPtr *tree);
! 271: void xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt);
! 272: xmlElementContentPtr xmlParseElementMixedContentDecl
! 273: (xmlParserCtxtPtr ctxt,
! 274: xmlParserInputPtr inputchk);
! 275: xmlElementContentPtr xmlParseElementChildrenContentDecl
! 276: (xmlParserCtxtPtr ctxt,
! 277: xmlParserInputPtr inputchk);
! 278: int xmlParseElementContentDecl(xmlParserCtxtPtr ctxt,
! 279: xmlChar *name,
! 280: xmlElementContentPtr *result);
! 281: int xmlParseElementDecl (xmlParserCtxtPtr ctxt);
! 282: void xmlParseMarkupDecl (xmlParserCtxtPtr ctxt);
! 283: int xmlParseCharRef (xmlParserCtxtPtr ctxt);
! 284: xmlEntityPtr xmlParseEntityRef (xmlParserCtxtPtr ctxt);
! 285: void xmlParseReference (xmlParserCtxtPtr ctxt);
! 286: void xmlParsePEReference (xmlParserCtxtPtr ctxt);
! 287: void xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt);
! 288: xmlChar * xmlParseAttribute (xmlParserCtxtPtr ctxt,
! 289: xmlChar **value);
! 290: xmlChar * xmlParseStartTag (xmlParserCtxtPtr ctxt);
! 291: void xmlParseEndTag (xmlParserCtxtPtr ctxt);
! 292: void xmlParseCDSect (xmlParserCtxtPtr ctxt);
! 293: void xmlParseContent (xmlParserCtxtPtr ctxt);
! 294: void xmlParseElement (xmlParserCtxtPtr ctxt);
! 295: xmlChar * xmlParseVersionNum (xmlParserCtxtPtr ctxt);
! 296: xmlChar * xmlParseVersionInfo (xmlParserCtxtPtr ctxt);
! 297: xmlChar * xmlParseEncName (xmlParserCtxtPtr ctxt);
! 298: xmlChar * xmlParseEncodingDecl (xmlParserCtxtPtr ctxt);
! 299: int xmlParseSDDecl (xmlParserCtxtPtr ctxt);
! 300: void xmlParseXMLDecl (xmlParserCtxtPtr ctxt);
! 301: void xmlParseTextDecl (xmlParserCtxtPtr ctxt);
! 302: void xmlParseMisc (xmlParserCtxtPtr ctxt);
! 303: void xmlParseExternalSubset (xmlParserCtxtPtr ctxt,
! 304: const xmlChar *ExternalID,
! 305: const xmlChar *SystemID);
! 306: /**
! 307: * XML_SUBSTITUTE_NONE:
! 308: *
! 309: * If no entities need to be substituted.
! 310: */
! 311: #define XML_SUBSTITUTE_NONE 0
! 312: /**
! 313: * XML_SUBSTITUTE_REF:
! 314: *
! 315: * Whether general entities need to be substituted.
! 316: */
! 317: #define XML_SUBSTITUTE_REF 1
! 318: /**
! 319: * XML_SUBSTITUTE_PEREF:
! 320: *
! 321: * Whether parameter entities need to be substituted.
! 322: */
! 323: #define XML_SUBSTITUTE_PEREF 2
! 324: /**
! 325: * XML_SUBSTITUTE_BOTH:
! 326: *
! 327: * Both general and parameter entities need to be substituted.
! 328: */
! 329: #define XML_SUBSTITUTE_BOTH 3
! 330:
! 331: xmlChar * xmlDecodeEntities (xmlParserCtxtPtr ctxt,
! 332: int len,
! 333: int what,
! 334: xmlChar end,
! 335: xmlChar end2,
! 336: xmlChar end3);
! 337: xmlChar * xmlStringDecodeEntities (xmlParserCtxtPtr ctxt,
! 338: const xmlChar *str,
! 339: int what,
! 340: xmlChar end,
! 341: xmlChar end2,
! 342: xmlChar end3);
! 343:
! 344: /*
! 345: * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP.
! 346: */
! 347: int nodePush (xmlParserCtxtPtr ctxt,
! 348: xmlNodePtr value);
! 349: xmlNodePtr nodePop (xmlParserCtxtPtr ctxt);
! 350: int inputPush (xmlParserCtxtPtr ctxt,
! 351: xmlParserInputPtr value);
! 352: xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt);
! 353: xmlChar *namePop (xmlParserCtxtPtr ctxt);
! 354: int namePush (xmlParserCtxtPtr ctxt,
! 355: xmlChar *value);
! 356:
! 357: /*
! 358: * other commodities shared between parser.c and parserInternals.
! 359: */
! 360: int xmlSkipBlankChars (xmlParserCtxtPtr ctxt);
! 361: int xmlStringCurrentChar (xmlParserCtxtPtr ctxt,
! 362: const xmlChar *cur,
! 363: int *len);
! 364: void xmlParserHandlePEReference(xmlParserCtxtPtr ctxt);
! 365: void xmlParserHandleReference(xmlParserCtxtPtr ctxt);
! 366: int xmlCheckLanguageID (const xmlChar *lang);
! 367:
! 368: /*
! 369: * Really core function shared with HTML parser.
! 370: */
! 371: int xmlCurrentChar (xmlParserCtxtPtr ctxt,
! 372: int *len);
! 373: int xmlCopyCharMultiByte (xmlChar *out,
! 374: int val);
! 375: int xmlCopyChar (int len,
! 376: xmlChar *out,
! 377: int val);
! 378: void xmlNextChar (xmlParserCtxtPtr ctxt);
! 379: void xmlParserInputShrink (xmlParserInputPtr in);
! 380:
! 381: #ifdef LIBXML_HTML_ENABLED
! 382: /*
! 383: * Actually comes from the HTML parser but launched from the init stuff.
! 384: */
! 385: void htmlInitAutoClose (void);
! 386: htmlParserCtxtPtr htmlCreateFileParserCtxt(const char *filename,
! 387: const char *encoding);
! 388: #endif
! 389:
! 390: /*
! 391: * Specific function to keep track of entities references
! 392: * and used by the XSLT debugger.
! 393: */
! 394: /**
! 395: * xmlEntityReferenceFunc:
! 396: * @ent: the entity
! 397: * @firstNode: the fist node in the chunk
! 398: * @lastNode: the last nod in the chunk
! 399: *
! 400: * Callback function used when one needs to be able to track back the
! 401: * provenance of a chunk of nodes inherited from an entity replacement.
! 402: */
! 403: typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent,
! 404: xmlNodePtr firstNode,
! 405: xmlNodePtr lastNode);
! 406:
! 407: void xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func);
! 408:
! 409:
! 410: #ifdef __cplusplus
! 411: }
! 412: #endif
! 413: #endif /* __XML_PARSER_INTERNALS_H__ */
E-mail: