// Automatically generated by clay-bindgen
// language: c

import unix.*;
import libc.*;

private alias OpaquePointer = RawPointer;
private alias UnknownType = Int;
private alias AUnionType = Int;


alias XML_Char = CChar;

alias XML_LChar = CChar;

alias XML_Index = CLong;

alias XML_Size = CULong;

alias XML_Parser = OpaquePointer;

alias XML_Bool = CUChar;

alias XML_STATUS_ERROR = 0;
alias XML_STATUS_OK = 1;
alias XML_STATUS_SUSPENDED = 2;

alias XML_ERROR_NONE = 0;
alias XML_ERROR_NO_MEMORY = 1;
alias XML_ERROR_SYNTAX = 2;
alias XML_ERROR_NO_ELEMENTS = 3;
alias XML_ERROR_INVALID_TOKEN = 4;
alias XML_ERROR_UNCLOSED_TOKEN = 5;
alias XML_ERROR_PARTIAL_CHAR = 6;
alias XML_ERROR_TAG_MISMATCH = 7;
alias XML_ERROR_DUPLICATE_ATTRIBUTE = 8;
alias XML_ERROR_JUNK_AFTER_DOC_ELEMENT = 9;
alias XML_ERROR_PARAM_ENTITY_REF = 10;
alias XML_ERROR_UNDEFINED_ENTITY = 11;
alias XML_ERROR_RECURSIVE_ENTITY_REF = 12;
alias XML_ERROR_ASYNC_ENTITY = 13;
alias XML_ERROR_BAD_CHAR_REF = 14;
alias XML_ERROR_BINARY_ENTITY_REF = 15;
alias XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF = 16;
alias XML_ERROR_MISPLACED_XML_PI = 17;
alias XML_ERROR_UNKNOWN_ENCODING = 18;
alias XML_ERROR_INCORRECT_ENCODING = 19;
alias XML_ERROR_UNCLOSED_CDATA_SECTION = 20;
alias XML_ERROR_EXTERNAL_ENTITY_HANDLING = 21;
alias XML_ERROR_NOT_STANDALONE = 22;
alias XML_ERROR_UNEXPECTED_STATE = 23;
alias XML_ERROR_ENTITY_DECLARED_IN_PE = 24;
alias XML_ERROR_FEATURE_REQUIRES_XML_DTD = 25;
alias XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING = 26;
alias XML_ERROR_UNBOUND_PREFIX = 27;
alias XML_ERROR_UNDECLARING_PREFIX = 28;
alias XML_ERROR_INCOMPLETE_PE = 29;
alias XML_ERROR_XML_DECL = 30;
alias XML_ERROR_TEXT_DECL = 31;
alias XML_ERROR_PUBLICID = 32;
alias XML_ERROR_SUSPENDED = 33;
alias XML_ERROR_NOT_SUSPENDED = 34;
alias XML_ERROR_ABORTED = 35;
alias XML_ERROR_FINISHED = 36;
alias XML_ERROR_SUSPEND_PE = 37;
alias XML_ERROR_RESERVED_PREFIX_XML = 38;
alias XML_ERROR_RESERVED_PREFIX_XMLNS = 39;
alias XML_ERROR_RESERVED_NAMESPACE_URI = 40;

alias XML_CTYPE_EMPTY = 1;
alias XML_CTYPE_ANY = 2;
alias XML_CTYPE_MIXED = 3;
alias XML_CTYPE_NAME = 4;
alias XML_CTYPE_CHOICE = 5;
alias XML_CTYPE_SEQ = 6;

alias XML_CQUANT_NONE = 0;
alias XML_CQUANT_OPT = 1;
alias XML_CQUANT_REP = 2;
alias XML_CQUANT_PLUS = 3;

alias XML_Content = Struct_XML_cp;

record Struct_XML_cp (
    type : Int,
    quant : Int,
    name : Pointer[CChar],
    numchildren : UInt,
    children : Pointer[XML_Content],
);

alias XML_ElementDeclHandler = CCodePointer[[RawPointer,Pointer[CChar],Pointer[Struct_XML_cp]],[]];

external XML_SetElementDeclHandler(
    parser : XML_Parser,
    eldecl : XML_ElementDeclHandler);

alias XML_AttlistDeclHandler = CCodePointer[[RawPointer,Pointer[CChar],Pointer[CChar],Pointer[CChar],Pointer[CChar],Int],[]];

external XML_SetAttlistDeclHandler(
    parser : XML_Parser,
    attdecl : XML_AttlistDeclHandler);

alias XML_XmlDeclHandler = CCodePointer[[RawPointer,Pointer[CChar],Pointer[CChar],Int],[]];

external XML_SetXmlDeclHandler(
    parser : XML_Parser,
    xmldecl : XML_XmlDeclHandler);

record UnnamedStruct4 (
    malloc_fcn : CCodePointer[[CULong],[RawPointer]],
    realloc_fcn : CCodePointer[[RawPointer,CULong],[RawPointer]],
    free_fcn : CCodePointer[[RawPointer],[]],
);

alias XML_Memory_Handling_Suite = UnnamedStruct4;

external XML_ParserCreate(
    encoding : Pointer[CChar]) : XML_Parser;

external XML_ParserCreateNS(
    encoding : Pointer[CChar],
    namespaceSeparator : CChar) : XML_Parser;

external XML_ParserCreate_MM(
    encoding : Pointer[CChar],
    memsuite : Pointer[XML_Memory_Handling_Suite],
    namespaceSeparator : Pointer[CChar]) : XML_Parser;

external XML_ParserReset(
    parser : XML_Parser,
    encoding : Pointer[CChar]) : CUChar;

alias XML_StartElementHandler = CCodePointer[[RawPointer,Pointer[CChar],Pointer[Pointer[CChar]]],[]];

alias XML_EndElementHandler = CCodePointer[[RawPointer,Pointer[CChar]],[]];

alias XML_CharacterDataHandler = CCodePointer[[RawPointer,Pointer[CChar],Int],[]];

alias XML_ProcessingInstructionHandler = CCodePointer[[RawPointer,Pointer[CChar],Pointer[CChar]],[]];

alias XML_CommentHandler = CCodePointer[[RawPointer,Pointer[CChar]],[]];

alias XML_StartCdataSectionHandler = CCodePointer[[RawPointer],[]];

alias XML_EndCdataSectionHandler = CCodePointer[[RawPointer],[]];

alias XML_DefaultHandler = CCodePointer[[RawPointer,Pointer[CChar],Int],[]];

alias XML_StartDoctypeDeclHandler = CCodePointer[[RawPointer,Pointer[CChar],Pointer[CChar],Pointer[CChar],Int],[]];

alias XML_EndDoctypeDeclHandler = CCodePointer[[RawPointer],[]];

alias XML_EntityDeclHandler = CCodePointer[[RawPointer,Pointer[CChar],Int,Pointer[CChar],Int,Pointer[CChar],Pointer[CChar],Pointer[CChar],Pointer[CChar]],[]];

external XML_SetEntityDeclHandler(
    parser : XML_Parser,
    handler : XML_EntityDeclHandler);

alias XML_UnparsedEntityDeclHandler = CCodePointer[[RawPointer,Pointer[CChar],Pointer[CChar],Pointer[CChar],Pointer[CChar],Pointer[CChar]],[]];

alias XML_NotationDeclHandler = CCodePointer[[RawPointer,Pointer[CChar],Pointer[CChar],Pointer[CChar],Pointer[CChar]],[]];

alias XML_StartNamespaceDeclHandler = CCodePointer[[RawPointer,Pointer[CChar],Pointer[CChar]],[]];

alias XML_EndNamespaceDeclHandler = CCodePointer[[RawPointer,Pointer[CChar]],[]];

alias XML_NotStandaloneHandler = CCodePointer[[RawPointer],[Int]];

alias XML_ExternalEntityRefHandler = CCodePointer[[OpaquePointer,Pointer[CChar],Pointer[CChar],Pointer[CChar],Pointer[CChar]],[Int]];

alias XML_SkippedEntityHandler = CCodePointer[[RawPointer,Pointer[CChar],Int],[]];

record UnnamedStruct5 (
    map : Array[Int,256],
    data : RawPointer,
    convert : CCodePointer[[RawPointer,Pointer[CChar]],[Int]],
    release : CCodePointer[[RawPointer],[]],
);

alias XML_Encoding = UnnamedStruct5;

alias XML_UnknownEncodingHandler = CCodePointer[[RawPointer,Pointer[CChar],Pointer[UnnamedStruct5]],[Int]];

external XML_SetElementHandler(
    parser : XML_Parser,
    start : XML_StartElementHandler,
    end : XML_EndElementHandler);

external XML_SetStartElementHandler(
    parser : XML_Parser,
    handler : XML_StartElementHandler);

external XML_SetEndElementHandler(
    parser : XML_Parser,
    handler : XML_EndElementHandler);

external XML_SetCharacterDataHandler(
    parser : XML_Parser,
    handler : XML_CharacterDataHandler);

external XML_SetProcessingInstructionHandler(
    parser : XML_Parser,
    handler : XML_ProcessingInstructionHandler);

external XML_SetCommentHandler(
    parser : XML_Parser,
    handler : XML_CommentHandler);

external XML_SetCdataSectionHandler(
    parser : XML_Parser,
    start : XML_StartCdataSectionHandler,
    end : XML_EndCdataSectionHandler);

external XML_SetStartCdataSectionHandler(
    parser : XML_Parser,
    start : XML_StartCdataSectionHandler);

external XML_SetEndCdataSectionHandler(
    parser : XML_Parser,
    end : XML_EndCdataSectionHandler);

external XML_SetDefaultHandler(
    parser : XML_Parser,
    handler : XML_DefaultHandler);

external XML_SetDefaultHandlerExpand(
    parser : XML_Parser,
    handler : XML_DefaultHandler);

external XML_SetDoctypeDeclHandler(
    parser : XML_Parser,
    start : XML_StartDoctypeDeclHandler,
    end : XML_EndDoctypeDeclHandler);

external XML_SetStartDoctypeDeclHandler(
    parser : XML_Parser,
    start : XML_StartDoctypeDeclHandler);

external XML_SetEndDoctypeDeclHandler(
    parser : XML_Parser,
    end : XML_EndDoctypeDeclHandler);

external XML_SetUnparsedEntityDeclHandler(
    parser : XML_Parser,
    handler : XML_UnparsedEntityDeclHandler);

external XML_SetNotationDeclHandler(
    parser : XML_Parser,
    handler : XML_NotationDeclHandler);

external XML_SetNamespaceDeclHandler(
    parser : XML_Parser,
    start : XML_StartNamespaceDeclHandler,
    end : XML_EndNamespaceDeclHandler);

external XML_SetStartNamespaceDeclHandler(
    parser : XML_Parser,
    start : XML_StartNamespaceDeclHandler);

external XML_SetEndNamespaceDeclHandler(
    parser : XML_Parser,
    end : XML_EndNamespaceDeclHandler);

external XML_SetNotStandaloneHandler(
    parser : XML_Parser,
    handler : XML_NotStandaloneHandler);

external XML_SetExternalEntityRefHandler(
    parser : XML_Parser,
    handler : XML_ExternalEntityRefHandler);

external XML_SetExternalEntityRefHandlerArg(
    parser : XML_Parser,
    arg : RawPointer);

external XML_SetSkippedEntityHandler(
    parser : XML_Parser,
    handler : XML_SkippedEntityHandler);

external XML_SetUnknownEncodingHandler(
    parser : XML_Parser,
    handler : XML_UnknownEncodingHandler,
    encodingHandlerData : RawPointer);

external XML_DefaultCurrent(
    parser : XML_Parser);

external XML_SetReturnNSTriplet(
    parser : XML_Parser,
    do_nst : Int);

external XML_SetUserData(
    parser : XML_Parser,
    userData : RawPointer);

external XML_SetEncoding(
    parser : XML_Parser,
    encoding : Pointer[CChar]) : Int;

external XML_UseParserAsHandlerArg(
    parser : XML_Parser);

external XML_UseForeignDTD(
    parser : XML_Parser,
    useDTD : CUChar) : Int;

external XML_SetBase(
    parser : XML_Parser,
    base : Pointer[CChar]) : Int;

external XML_GetBase(
    parser : XML_Parser) : Pointer[CChar];

external XML_GetSpecifiedAttributeCount(
    parser : XML_Parser) : Int;

external XML_GetIdAttributeIndex(
    parser : XML_Parser) : Int;

external XML_Parse(
    parser : XML_Parser,
    s : Pointer[CChar],
    len : Int,
    isFinal : Int) : Int;

external XML_GetBuffer(
    parser : XML_Parser,
    len : Int) : RawPointer;

external XML_ParseBuffer(
    parser : XML_Parser,
    len : Int,
    isFinal : Int) : Int;

external XML_StopParser(
    parser : XML_Parser,
    resumable : CUChar) : Int;

external XML_ResumeParser(
    parser : XML_Parser) : Int;

alias XML_INITIALIZED = 0;
alias XML_PARSING = 1;
alias XML_FINISHED = 2;
alias XML_SUSPENDED = 3;

record UnnamedStruct6 (
    parsing : Int,
    finalBuffer : CUChar,
);

alias XML_ParsingStatus = UnnamedStruct6;

external XML_GetParsingStatus(
    parser : XML_Parser,
    status : Pointer[XML_ParsingStatus]);

external XML_ExternalEntityParserCreate(
    parser : XML_Parser,
    context : Pointer[CChar],
    encoding : Pointer[CChar]) : XML_Parser;

alias XML_PARAM_ENTITY_PARSING_NEVER = 0;
alias XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE = 1;
alias XML_PARAM_ENTITY_PARSING_ALWAYS = 2;

external XML_SetParamEntityParsing(
    parser : XML_Parser,
    parsing : Int) : Int;

external XML_GetErrorCode(
    parser : XML_Parser) : Int;

external XML_GetCurrentLineNumber(
    parser : XML_Parser) : CULong;

external XML_GetCurrentColumnNumber(
    parser : XML_Parser) : CULong;

external XML_GetCurrentByteIndex(
    parser : XML_Parser) : CLong;

external XML_GetCurrentByteCount(
    parser : XML_Parser) : Int;

external XML_GetInputContext(
    parser : XML_Parser,
    offset : Pointer[Int],
    size : Pointer[Int]) : Pointer[CChar];

external XML_FreeContentModel(
    parser : XML_Parser,
    model : Pointer[XML_Content]);

external XML_MemMalloc(
    parser : XML_Parser,
    size : CULong) : RawPointer;

external XML_MemRealloc(
    parser : XML_Parser,
    ptr : RawPointer,
    size : CULong) : RawPointer;

external XML_MemFree(
    parser : XML_Parser,
    ptr : RawPointer);

external XML_ParserFree(
    parser : XML_Parser);

external XML_ErrorString(
    code : Int) : Pointer[CChar];

external XML_ExpatVersion() : Pointer[CChar];

record UnnamedStruct7 (
    major : Int,
    minor : Int,
    micro : Int,
);

alias XML_Expat_Version = UnnamedStruct7;

external XML_ExpatVersionInfo() : XML_Expat_Version;

alias XML_FEATURE_END = 0;
alias XML_FEATURE_UNICODE = 1;
alias XML_FEATURE_UNICODE_WCHAR_T = 2;
alias XML_FEATURE_DTD = 3;
alias XML_FEATURE_CONTEXT_BYTES = 4;
alias XML_FEATURE_MIN_SIZE = 5;
alias XML_FEATURE_SIZEOF_XML_CHAR = 6;
alias XML_FEATURE_SIZEOF_XML_LCHAR = 7;
alias XML_FEATURE_NS = 8;
alias XML_FEATURE_LARGE_SIZE = 9;

record UnnamedStruct8 (
    feature : Int,
    name : Pointer[CChar],
    value : CLong,
);

alias XML_Feature = UnnamedStruct8;

external XML_GetFeatureList() : Pointer[XML_Feature];
