<commit_before>#ifndef MUSICREADER_H_
#define MUSICREADER_H_

/**
 * Everything in the extern C block is the interop between C++ and Haskell's Foreign Function Interface
 */

/* Use C linkage to guarantee compatibility with GHC FFI */
extern "C" {

    enum codec
    {
        MP3 = 1,
        FLAC = 2,
        OGG_VORBIS = 3,
        MP4 = 4,
        MPEG = 5
    };

    struct music_metadata
    {
        enum codec codec_type;
        int length,
            bitrate,
            channels;
        char *title,
             *artist,
             *album,
             *comment,
             *genre;
        /*This is implemented as an unsigned int in TagLib::Tag
         * but it is highly unlikely an album contains enough
         * tracks to overflow the sign bit and this means Haskell
         * doesn't have to know about unsigned integers*/
        int track;
    };

    /**
     * read metadata from file and return new music_metadata
     */
    struct music_metadata* read_metadata(char*);
}

#endif<commit_msg>converted enum to int defines because enum sizes are not guaranteed by the compiler<commit_after>#ifndef MUSICREADER_H_
#define MUSICREADER_H_

/**
 * Everything in the extern C block is the interop between C++ and Haskell's Foreign Function Interface
 */

/* Use C linkage to guarantee compatibility with GHC FFI */
extern "C" {

//use an int to store codec type instead of an enum because we need to know the byte offsets in the struct and enums are technically not always ints
//see http://stackoverflow.com/questions/1113855/is-the-sizeofenum-sizeofint-always
#define MP3_CODEC 1
#define FLAC_CODEC 2
#define OGG_VORBIS_CODEC 3
#define MP4_CODEC 4
#define MPEG_CODEC 5

    struct music_metadata
    {
        int32_t codec;
        int32_t length,
                bitrate,
                channels;
        //on x86, pointers will be 4 bytes
        //on AMD64, pointers will be 8 bytes
        char *title,
             *artist,
             *album,
             *comment,
             *genre;
        /*This is implemented as an unsigned int in TagLib::Tag
         * but it is highly unlikely an album contains enough
         * tracks to overflow the sign bit and this means Haskell
         * doesn't have to know about unsigned integers*/
        int32_t track;
    };

    /**
     * read metadata from file and return new music_metadata
     */
    struct music_metadata* read_metadata(char*);
}

#endif
{'fraction_non_alphanumeric': 0.06625766871165645, 'fraction_numerical': 0.013496932515337423, 'mean_word_length': 2.1278772378516626, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5071436', 'n_tokens_mistral': 730, 'n_tokens_neox': 672, 'n_words': 273}