<commit_before>#include <boost/bind.hpp>
#include <boost/python.hpp>
#include <boost/thread.hpp>
#include <dart/simulation/simulation.h>
#include <dart/gui/gui.h>

using ::dart::gui::SimWindow;
using ::dart::simulation::World;

static SimWindow *gWindow = NULL;
static boost::mutex gMutex;
static boost::condition_variable gCondition;

static void SimWindow_refresh()
{
    if (gWindow) {
        gWindow->refresh();
    }
}

static void SimWindow_main(int width, int height, std::string const &name)
{
    char **argv = NULL;
    int argc = 0;

    std::cout << "glutInit >>>" << std::endl;
    glutInit(&argc, argv);
    std::cout << "glutInit <<<" << std::endl;

    // Notify SimWindow to return.
    {
        boost::mutex::scoped_lock lock(gMutex);
        gWindow = new SimWindow; 
        gWindow->initWindow(width, height, name.c_str());

        gCondition.notify_one();
    }
    // We intentionally leave the mutex locked here.

    // Start the main loop. This will run until glutLeaveMainLoop is called.
    std::cout << "glutMainLoop >>>" << std::endl;
    glutIdleFunc(&SimWindow_refresh);
    glutMainLoop();
    std::cout << "glutMainLoop <<<" << std::endl;
}

static SimWindow *SimWindow_constructor(int width, int height,
                                        std::string const &name)
{
    boost::thread render_thread(
        boost::bind(&SimWindow_main, width, height, name)
    );

    // Wait for OpenGL to initialize.
    std::cout << "waiting >>>" << std::endl;
    {
        boost::mutex::scoped_lock lock(gMutex);
        while (!gWindow) {
            gCondition.wait(lock);
        }
    }
    std::cout << "waiting <<<" << std::endl;

    return gWindow;
}

static World *SimWindow_get_world(SimWindow *window)
{
    throw std::runtime_error("get_world() is not implemented.");
}

void python_SimWindow()
{
    using namespace ::boost::python;

    class_<SimWindow>("SimWindow", no_init)
        .def("__init__", make_constructor(&SimWindow_constructor))
        .add_property("world", 
            make_function(&SimWindow_get_world,
                          return_value_policy<manage_new_object>()),
            &SimWindow::setWorld)
        .def("draw_arrow_2d", &::dart::gui::drawArrow2D)
        .staticmethod("draw_arrow_2d")
        .def("draw_arrow_3d", &::dart::gui::drawArrow3D)
        .staticmethod("draw_arrow_3d")
        ;
}
<commit_msg>Removed prints.<commit_after>#include <boost/bind.hpp>
#include <boost/python.hpp>
#include <boost/thread.hpp>
#include <dart/simulation/simulation.h>
#include <dart/gui/gui.h>

using ::dart::gui::SimWindow;
using ::dart::simulation::World;

static SimWindow *gWindow = NULL;
static boost::mutex gMutex;
static boost::condition_variable gCondition;

static void SimWindow_refresh()
{
    if (gWindow) {
        gWindow->refresh();
    }
}

static void SimWindow_main(int width, int height, std::string const &name)
{
    char **argv = NULL;
    int argc = 0;

    glutInit(&argc, argv);

    // Notify SimWindow to return.
    {
        boost::mutex::scoped_lock lock(gMutex);
        gWindow = new SimWindow; 
        gWindow->initWindow(width, height, name.c_str());

        gCondition.notify_one();
    }
    // We intentionally leave the mutex locked here.

    // Start the main loop. This will run until glutLeaveMainLoop is called.
    glutIdleFunc(&SimWindow_refresh);
    glutMainLoop();
}

static SimWindow *SimWindow_constructor(int width, int height,
                                        std::string const &name)
{
    boost::thread render_thread(
        boost::bind(&SimWindow_main, width, height, name)
    );

    // Wait for OpenGL to initialize.
    boost::mutex::scoped_lock lock(gMutex);
    while (!gWindow) {
        gCondition.wait(lock);
    }
    return gWindow;
}

static World *SimWindow_get_world(SimWindow *window)
{
    throw std::runtime_error("get_world() is not implemented.");
}

void python_SimWindow()
{
    using namespace ::boost::python;

    class_<SimWindow>("SimWindow", no_init)
        .def("__init__", make_constructor(&SimWindow_constructor))
        .add_property("world", 
            make_function(&SimWindow_get_world,
                          return_value_policy<manage_new_object>()),
            &SimWindow::setWorld)
        .def("draw_arrow_2d", &::dart::gui::drawArrow2D)
        .staticmethod("draw_arrow_2d")
        .def("draw_arrow_3d", &::dart::gui::drawArrow3D)
        .staticmethod("draw_arrow_3d")
        ;
}

{'fraction_non_alphanumeric': 0.13895726113224435, 'fraction_numerical': 0.003132691877377489, 'mean_word_length': 3.0784671532846715, 'pattern_counts': {'":': 0, '<': 50, '<?xml version=': 0, '>': 30, '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': '1341205', 'n_tokens_mistral': 1425, 'n_tokens_neox': 1403, 'n_words': 289}