<commit_before>
#[link(name = "exempi")]
extern crate libc;

use libc::{c_int, c_char, size_t};

pub enum Xmp {}
pub enum XmpFile {}
pub enum XmpString {}
pub enum XmpIterator {}

#[derive(Clone, Copy, PartialEq)]
#[repr(i32)]
/// XMP errors.
pub enum XmpError {
    /* More or less generic error codes. */
    /// Generic unknown error.
    Unknown          =   0,
    /// Generic undefined error.
    TBD              =   -1,
    /// Generic unavailable error.
    Unavailable      =   -2,
    /// Generic bad object error.
    BadObject        =   -3,
    /// Generic bad parameter error.
    BadParam         =   -4,
    /// Generic bad value error.
    BadValue         =   -5,
    /// Generic assertion failure.
    AssertFailure    =   -6,
    /// Generic enforcement failure.
    EnforceFailure   =   -7,
    /// Generic unimplemented error.
    Unimplemented    =   -8,
    /// Generic internal failure.
    InternalFailure  =   -9,
    /// Generic deprecated error.
    Deprecated       =  -10,
    /// Generic external failure.
    ExternalFailure  =  -11,
    /// Generic user abort error.
    UserAbort        =  -12,
    /// Generic standard exception.
    StdException     =  -13,
    /// Generic unknown exception.
    UnknownException =  -14,
    /// Generic out-of-memory error.
    NoMemory         =  -15,

    /* More specific parameter error codes.  */
    /// Bad schema parameter.
    BadSchema        = -101,
    /// Bad XPath parameter.
    BadXPath         = -102,
    /// Bad options parameter.
    BadOptions       = -103,
    /// Bad index parameter.
    BadIndex         = -104,
    /// Bad iteration position.
    BadIterPosition  = -105,
    /// XML parsing error.
    BadParse         = -106,
    /// Serialization error.
    BadSerialize     = -107,
    /// File format error.
    BadFileFormat    = -108,
    /// No file handler found for format.
    NoFileHandler    = -109,
    /// Data too large for JPEG file format.
    TooLargeForJPEG  = -110,

    /* File format and internal structure error codes. */
    /// XML format error.
    BadXML           = -201,
    /// RDF format error.
    BadRDF           = -202,
    /// XMP format error.
    BadXMP           = -203,
    /// Empty iterator.
    EmptyIterator    = -204,
    /// Unicode error.
    BadUnicode       = -205,
    /// TIFF format error.
    BadTIFF          = -206,
    /// JPEG format error.
    BadJPEG          = -207,
    /// PSD format error.
    BadPSD           = -208,
    /// PSIR format error.
    BadPSIR          = -209,
    /// IPTC format error.
    BadIPTC          = -210,
    /// MPEG format error.
    BadMPEG          = -211,
}

#[derive(Clone, Copy, PartialEq)]
#[repr(i32)]
pub enum TzSign {
    /// West of UTC
    West = -1,
    /// UTC
    UTC = 0,
    /// East of UTC
    East = 1,
}

// the C defined struct.
#[repr(C)]
pub struct XmpDateTime {
    pub year: i32,
    pub month: i32,
    pub day: i32,
    pub hour: i32,
    pub minute: i32,
    pub second: i32,
    pub tz_sign: TzSign,
    pub tz_hour: i32,
    pub tz_minute: i32,
    pub nano_second: i32,
}

impl Default for XmpDateTime {
    fn default() -> Self {
        unsafe { ::std::mem::zeroed() }
    }
}

#[repr(C)]
pub struct XmpPacketInfo {
    pub offset: i64,
    pub length: i32,
    pub pad_size: i32,
    pub char_form: u8,
    pub writeable: bool,
    pub has_wrapper: bool,
    pub pad: u8,
}

#[derive(Clone, Copy, PartialEq)]
#[repr(u32)]
/// Public file formats.
pub enum FileType {
    PDF = 0x50444620u32, /* 'PDF ' */
    PS = 0x50532020u32,  /* 'PS  ', general PostScript following DSC
                                  conventions. */
    EPS = 0x45505320u32, /* 'EPS ', encapsulated PostScript. */

    JPEG = 0x4A504547u32,   /* 'JPEG' */
    JPEG2K = 0x4A505820u32, /* 'JPX ', ISO 15444-1 */
    TIFF = 0x54494646u32,   /* 'TIFF' */
    GIF = 0x47494620u32,    /* 'GIF ' */
    PNG = 0x504E4720u32,    /* 'PNG ' */

    SWF = 0x53574620u32, /* 'SWF ' */
    FLA = 0x464C4120u32, /* 'FLA ' */
    FLV = 0x464C5620u32, /* 'FLV ' */

    MOV = 0x4D4F5620u32,   /* 'MOV ', Quicktime */
    AVI = 0x41564920u32,   /* 'AVI ' */
    CIN = 0x43494E20u32,   /* 'CIN ', Cineon */
    WAV = 0x57415620u32,   /* 'WAV ' */
    MP3 = 0x4D503320u32,   /* 'MP3 ' */
    SES = 0x53455320u32,   /* 'SES ', Audition session */
    CEL = 0x43454C20u32,   /* 'CEL ', Audition loop */
    MPEG = 0x4D504547u32,  /* 'MPEG' */
    MPEG2 = 0x4D503220u32, /* 'MP2 ' */
    MPEG4 = 0x4D503420u32, /* 'MP4 ', ISO 14494-12 and -14 */
    WMAV = 0x574D4156u32,  /* 'WMAV', Windows Media Audio and Video */
    AIFF = 0x41494646u32,  /* 'AIFF' */

    HTML = 0x48544D4Cu32, /* 'HTML' */
    XML = 0x584D4C20u32,  /* 'XML ' */
    TEXT = 0x74657874u32, /* 'text' */
<commit_msg>exempi-sys: added WEBP type (new in 2.4)<commit_after>
#[link(name = "exempi")]
extern crate libc;

use libc::{c_int, c_char, size_t};

pub enum Xmp {}
pub enum XmpFile {}
pub enum XmpString {}
pub enum XmpIterator {}

#[derive(Clone, Copy, PartialEq)]
#[repr(i32)]
/// XMP errors.
pub enum XmpError {
    /* More or less generic error codes. */
    /// Generic unknown error.
    Unknown          =   0,
    /// Generic undefined error.
    TBD              =   -1,
    /// Generic unavailable error.
    Unavailable      =   -2,
    /// Generic bad object error.
    BadObject        =   -3,
    /// Generic bad parameter error.
    BadParam         =   -4,
    /// Generic bad value error.
    BadValue         =   -5,
    /// Generic assertion failure.
    AssertFailure    =   -6,
    /// Generic enforcement failure.
    EnforceFailure   =   -7,
    /// Generic unimplemented error.
    Unimplemented    =   -8,
    /// Generic internal failure.
    InternalFailure  =   -9,
    /// Generic deprecated error.
    Deprecated       =  -10,
    /// Generic external failure.
    ExternalFailure  =  -11,
    /// Generic user abort error.
    UserAbort        =  -12,
    /// Generic standard exception.
    StdException     =  -13,
    /// Generic unknown exception.
    UnknownException =  -14,
    /// Generic out-of-memory error.
    NoMemory         =  -15,

    /* More specific parameter error codes.  */
    /// Bad schema parameter.
    BadSchema        = -101,
    /// Bad XPath parameter.
    BadXPath         = -102,
    /// Bad options parameter.
    BadOptions       = -103,
    /// Bad index parameter.
    BadIndex         = -104,
    /// Bad iteration position.
    BadIterPosition  = -105,
    /// XML parsing error.
    BadParse         = -106,
    /// Serialization error.
    BadSerialize     = -107,
    /// File format error.
    BadFileFormat    = -108,
    /// No file handler found for format.
    NoFileHandler    = -109,
    /// Data too large for JPEG file format.
    TooLargeForJPEG  = -110,

    /* File format and internal structure error codes. */
    /// XML format error.
    BadXML           = -201,
    /// RDF format error.
    BadRDF           = -202,
    /// XMP format error.
    BadXMP           = -203,
    /// Empty iterator.
    EmptyIterator    = -204,
    /// Unicode error.
    BadUnicode       = -205,
    /// TIFF format error.
    BadTIFF          = -206,
    /// JPEG format error.
    BadJPEG          = -207,
    /// PSD format error.
    BadPSD           = -208,
    /// PSIR format error.
    BadPSIR          = -209,
    /// IPTC format error.
    BadIPTC          = -210,
    /// MPEG format error.
    BadMPEG          = -211,
}

#[derive(Clone, Copy, PartialEq)]
#[repr(i32)]
pub enum TzSign {
    /// West of UTC
    West = -1,
    /// UTC
    UTC = 0,
    /// East of UTC
    East = 1,
}

// the C defined struct.
#[repr(C)]
pub struct XmpDateTime {
    pub year: i32,
    pub month: i32,
    pub day: i32,
    pub hour: i32,
    pub minute: i32,
    pub second: i32,
    pub tz_sign: TzSign,
    pub tz_hour: i32,
    pub tz_minute: i32,
    pub nano_second: i32,
}

impl Default for XmpDateTime {
    fn default() -> Self {
        unsafe { ::std::mem::zeroed() }
    }
}

#[repr(C)]
pub struct XmpPacketInfo {
    pub offset: i64,
    pub length: i32,
    pub pad_size: i32,
    pub char_form: u8,
    pub writeable: bool,
    pub has_wrapper: bool,
    pub pad: u8,
}

#[derive(Clone, Copy, PartialEq)]
#[repr(u32)]
/// Public file formats.
pub enum FileType {
    PDF = 0x50444620u32, /* 'PDF ' */
    PS = 0x50532020u32,  /* 'PS  ', general PostScript following DSC
                                  conventions. */
    EPS = 0x45505320u32, /* 'EPS ', encapsulated PostScript. */

    JPEG = 0x4A504547u32,   /* 'JPEG' */
    JPEG2K = 0x4A505820u32, /* 'JPX ', ISO 15444-1 */
    TIFF = 0x54494646u32,   /* 'TIFF' */
    GIF = 0x47494620u32,    /* 'GIF ' */
    PNG = 0x504E4720u32,    /* 'PNG ' */
    WEBP = 0x57454250u32,   /* 'WEBP' */

    SWF = 0x53574620u32, /* 'SWF ' */
    FLA = 0x464C4120u32, /* 'FLA ' */
    FLV = 0x464C5620u32, /* 'FLV ' */

    MOV = 0x4D4F5620u32,   /* 'MOV ', Quicktime */
    AVI = 0x41564920u32,   /* 'AVI ' */
    CIN = 0x43494E20u32,   /* 'CIN ', Cineon */
    WAV = 0x57415620u32,   /* 'WAV ' */
    MP3 = 0x4D503320u32,   /* 'MP3 ' */
    SES = 0x53455320u32,   /* 'SES ', Audition session */
    CEL = 0x43454C20u32,   /* 'CEL ', Audition loop */
    MPEG = 0x4D504547u32,  /* 'MPEG' */
    MPEG2 = 0x4D503220u32, /* 'MP2 ' */
    MPEG4 = 0x4D503420u32, /* 'MP4 ', ISO 14494-12 and -14 */
    WMAV = 0x574D4156u32,  /* 'WMAV', Windows Media Audio and Video */
    AIFF = 0x41494646u32,  /* 'AIFF' */

    HTML = 0x48544D4Cu32, /* 'HTML' */
    XML = 0x584D4C20u32,  /* 'XML ' */
    TEXT = 0x74657874u32, /* 'text' */

{'fraction_non_alphanumeric': 0.13855296080066723, 'fraction_numerical': 0.08684320266889074, 'mean_word_length': 1.6773653363103544, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2719035', 'n_tokens_mistral': 3949, 'n_tokens_neox': 3445, 'n_words': 901}