<commit_before>
#include <iostream>
#include <algorithm>

#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>

#include <glbinding/featured/gl32.h>

#include <glbinding/AbstractFunction.h>
#include <glbinding/Meta.h>
#include <glbinding/Query.h>
#include <glbinding/Version.h>


using namespace gl32;


void error(int errnum, const char * errmsg)
{
    std::cerr << errnum << ": " << errmsg << std::endl;
}

namespace
{
    const GLchar * vertSource = R"(
        #version 150
        #extension GL_ARB_explicit_attrib_location : require

        layout (location = 0) in vec2 a_vertex;

        out vec4 color;

        void main()
        {
            gl_Position = vec4(a_vertex, 0.0, 1.0);
            color = vec4(a_vertex * 0.5 + 0.5, 0.0, 1.0);
        }
        )";

    const GLchar * fragSource = R"(
        #version 150
        #extension GL_ARB_explicit_attrib_location : require

        layout (location = 0) out vec4 fragColor;

        in vec4 color;

        void main()
        {
            fragColor = color;
        }
        )";
}

int main(int, char * [])
{
    if (!glfwInit())
        return 1;

    glfwSetErrorCallback(error);

    GLFWwindow * window = glfwCreateWindow(320, 240, "", nullptr, nullptr);
    if (!window)
    {
        glfwTerminate();
        return -1;
    }

    glfwMakeContextCurrent(window);

    // print some gl infos (query)

    std::cout << std::endl
        << "OpenGL Version:  " << Query::version() << std::endl
        << "OpenGL Vendor:   " << Query::vendor() << std::endl
        << "OpenGL Renderer: " << Query::renderer() << std::endl
        << "OpenGL Revision: " << Meta::glRevision() << " (gl.xml)" << std::endl << std::endl;

    // initialize(); // rely on lazy init


    AbstractFunction::setCallbackLevelForAll(AbstractFunction::CallbackLevel::All);

    AbstractFunction::setUnresolvedCallback([](const AbstractFunction & f) 
        { std::cout << "Calling unresolved function: " << f.name() << std::endl; });

    AbstractFunction::setBeforeCallback([](const AbstractFunction & f) 
        { std::cout << f.name(); });

    AbstractFunction::setAfterCallback([](const AbstractFunction &) 
        { std::cout << std::endl; });

    AbstractFunction::setParametersCallback([](const AbstractFunction &
        , const std::vector<AbstractValue *> & parameters) 
        {
            std::cout << "(";

            for (unsigned i = 0; i < parameters.size(); ++i)<commit_msg>adjust callbacks example<commit_after>
#include <iostream>
#include <algorithm>

#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>

#include <glbinding/featured/gl32.h>

#include <glbinding/AbstractFunction.h>
#include <glbinding/Meta.h>
#include <glbinding/ContextInfo.h>
#include <glbinding/Version.h>


using namespace gl32;


void error(int errnum, const char * errmsg)
{
    std::cerr << errnum << ": " << errmsg << std::endl;
}

namespace
{
    const GLchar * vertSource = R"(
        #version 150
        #extension GL_ARB_explicit_attrib_location : require

        layout (location = 0) in vec2 a_vertex;

        out vec4 color;

        void main()
        {
            gl_Position = vec4(a_vertex, 0.0, 1.0);
            color = vec4(a_vertex * 0.5 + 0.5, 0.0, 1.0);
        }
        )";

    const GLchar * fragSource = R"(
        #version 150
        #extension GL_ARB_explicit_attrib_location : require

        layout (location = 0) out vec4 fragColor;

        in vec4 color;

        void main()
        {
            fragColor = color;
        }
        )";
}

int main(int, char * [])
{
    if (!glfwInit())
        return 1;

    glfwSetErrorCallback(error);

    GLFWwindow * window = glfwCreateWindow(320, 240, "", nullptr, nullptr);
    if (!window)
    {
        glfwTerminate();
        return -1;
    }

    glfwMakeContextCurrent(window);

    // print some gl infos (query)

    std::cout << std::endl
        << "OpenGL Version:  " << ContextInfo::version() << std::endl
        << "OpenGL Vendor:   " << ContextInfo::vendor() << std::endl
        << "OpenGL Renderer: " << ContextInfo::renderer() << std::endl
        << "OpenGL Revision: " << Meta::glRevision() << " (gl.xml)" << std::endl << std::endl;

    // initialize(); // rely on lazy init


    AbstractFunction::setCallbackLevelForAll(AbstractFunction::CallbackLevel::All);

    AbstractFunction::setUnresolvedCallback([](const AbstractFunction & f) 
        { std::cout << "Calling unresolved function: " << f.name() << std::endl; });

    AbstractFunction::setBeforeCallback([](const AbstractFunction & f) 
        { std::cout << f.name(); });

    AbstractFunction::setAfterCallback([](const AbstractFunction &) 
        { std::cout << std::endl; });

    AbstractFunction::setParametersCallback([](const AbstractFunction &
        , const std::vector<AbstractValue *> & parameters) 
        {
            std::cout << "(";

            for (unsigned i = 0; i < parameters.size(); ++i)
{'fraction_non_alphanumeric': 0.14891458713735037, 'fraction_numerical': 0.016230472712517752, 'mean_word_length': 2.654558932542624, 'pattern_counts': {'":': 2, '<': 123, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '2744823', 'n_tokens_mistral': 1600, 'n_tokens_neox': 1494, 'n_words': 335}