<commit_before>"""CFFI wrapper entry point."""

from cffi import FFI

ffi = FFI()
ffi.set_source(
    '_renderlib',
    """
    #include "renderlib.h"
    #include <GL/glew.h>
    """,
    include_dirs=[
        '../../build/include/renderlib',
        '../../deps/matlib/build/include'
    ],
    library_dirs=['../../build/lib'],
    libraries=['render'])

# OpenGL types
ffi.cdef(
    """
    typedef int... GLenum;
    typedef unsigned int... GLuint;
    enum {
        GL_TEXTURE_2D,
        GL_TEXTURE_RECTANGLE,
        ...
    };
    """)

# Core API
ffi.cdef(
    """
    int
    renderer_init();

    int
    renderer_present(void);

    void
    renderer_shutdown(void);
    """)

# Mesh API
ffi.cdef(
    """
    struct Mesh;

    struct Mesh*
    mesh_from_file(const char *filename);

    struct Mesh*
    mesh_from_buffer(const void *data, size_t data_size);

    void
    mesh_free(struct Mesh *mesh);
    """)

# Font API
ffi.cdef(
    """
    struct Font;

    struct Font*
    font_from_buffer(const void *data, size_t size, unsigned pt);

    struct Font*
    font_from_file(const char *filename, unsigned pt);

    void
    font_free(struct Font *font);
    """)

# Image API
# Font API
ffi.cdef(
    """
    enum {
        IMAGE_FORMAT_RGBA,
        IMAGE_FORMAT_RGB,
        IMAGE_CODEC_PNG,
        IMAGE_CODEC_JPEG,
        ...
    };

    struct Image {
        unsigned width, height;
        int format;
        ...;
    };

    struct Image*
    image_from_buffer(const void *data, size_t size, int codec);

    struct Image*<commit_msg>Gardening<commit_after>"""CFFI wrapper entry point."""

from cffi import FFI

ffi = FFI()
ffi.set_source(
    '_renderlib',
    """
    #include "renderlib.h"
    #include <GL/glew.h>
    """,
    include_dirs=[
        '../../build/include/renderlib',
        '../../deps/matlib/build/include'
    ],
    library_dirs=['../../build/lib'],
    libraries=['render'])

# OpenGL types
ffi.cdef(
    """
    typedef int... GLenum;
    typedef unsigned int... GLuint;
    enum {
        GL_TEXTURE_2D,
        GL_TEXTURE_RECTANGLE,
        ...
    };
    """)

# Core API
ffi.cdef(
    """
    int
    renderer_init();

    int
    renderer_present(void);

    void
    renderer_shutdown(void);
    """)

# Mesh API
ffi.cdef(
    """
    struct Mesh;

    struct Mesh*
    mesh_from_file(const char *filename);

    struct Mesh*
    mesh_from_buffer(const void *data, size_t data_size);

    void
    mesh_free(struct Mesh *mesh);
    """)

# Font API
ffi.cdef(
    """
    struct Font;

    struct Font*
    font_from_buffer(const void *data, size_t size, unsigned pt);

    struct Font*
    font_from_file(const char *filename, unsigned pt);

    void
    font_free(struct Font *font);
    """)

# Image API
ffi.cdef(
    """
    enum {
        IMAGE_FORMAT_RGBA,
        IMAGE_FORMAT_RGB,
        IMAGE_CODEC_PNG,
        IMAGE_CODEC_JPEG,
        ...
    };

    struct Image {
        unsigned width, height;
        int format;
        ...;
    };

    struct Image*
    image_from_buffer(const void *data, size_t size, int codec);

    struct Image*
{'fraction_non_alphanumeric': 0.13634905357715751, 'fraction_numerical': 0.0006416426050689766, 'mean_word_length': 2.056862745098039, 'pattern_counts': {'":': 0, '<': 5, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5961567', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1086, 'n_words': 231}