<commit_before>#include "server.h"
#include "channel.h"
#include "../version.h"

#include "stopwatch.h"


#ifdef _WIN32
#include "window_win.h"
#else
#ifdef _RASPI
#include "window_raspi.h"
#else
#endif
#endif

#ifndef _WIN32
#include <unistd.h>
#endif

void prompt()
{
#ifdef _WIN32
	::MessageBox(0, 
			L"Attach debugger?", 
			L"Debugger", 
			MB_YESNO|MB_ICONQUESTION);
#endif
}

void wait_for_a_while(uv_idle_t* handle, int status) 
{
   std::chrono::milliseconds timeout(10);
   std::this_thread::sleep_for(timeout);
}

Channel::Channel(const _priv&, 
		const std::string& id) 
	: _id(id)
{
	_iothread = 0;

	uv_mutex_init(&_lock);
	uv_cond_init(&_isReady);
}
	
Channel::~Channel()
{
	uv_cond_destroy(&_isReady);
	uv_mutex_destroy(&_lock);
}

int32_t Channel::run(const std::string& id)
{
	prompt();

	std::shared_ptr<Channel> channel(
			std::make_shared<Channel>(_priv{}, id));
	
	uv_thread_create(
			&channel->_iothread, 
			iothread, 
			channel.get());

	uv_cond_wait(&channel->_isReady, &channel->_lock);

	LOG(VERBOSE) << "channel: " << id << " opening ...";	
	
	gfx::startup();		

	{
		std::shared_ptr<gfx::Context> ctx;

      std::stringstream title;
      title << PRODUCT << " | " << "channel: " << channel->id();

#ifdef _WIN32
		auto window = win::Window::create(title.str(), channel);

		ctx = gfx::Context::create(window->handle());

		window->show();
		window->update();
#else

		auto window = rpi::Window::create();

		ctx = gfx::Context::create(window->handle());

#endif
		

		LOG(DEBUG) << "channel: staring rendering loop ...";

		uint32_t frame = 0;

		int64_t freq = hires_frequency();
		int64_t now, mark = hires_time();<commit_msg>switched to glew for linux<commit_after>#include "server.h"
#include "channel.h"
#include "../version.h"

#include "stopwatch.h"


#ifdef _WIN32
#include "window_win.h"
#else
#ifdef _RASPI
#include "window_raspi.h"
#else
#endif
#endif

#ifndef _WIN32
#include <unistd.h>
#endif

void prompt()
{
#ifdef _WIN32
	::MessageBox(0, 
			L"Attach debugger?", 
			L"Debugger", 
			MB_YESNO|MB_ICONQUESTION);
#endif
}

void wait_for_a_while(uv_idle_t* handle, int status) 
{
   std::chrono::milliseconds timeout(10);
   std::this_thread::sleep_for(timeout);
}

Channel::Channel(const _priv&, 
		const std::string& id) 
	: _id(id)
{
	_iothread = 0;

	uv_mutex_init(&_lock);
	uv_cond_init(&_isReady);
}
	
Channel::~Channel()
{
	uv_cond_destroy(&_isReady);
	uv_mutex_destroy(&_lock);
}

int32_t Channel::run(const std::string& id)
{
	prompt();

	std::shared_ptr<Channel> channel(
			std::make_shared<Channel>(_priv{}, id));
	
	uv_thread_create(
			&channel->_iothread, 
			iothread, 
			channel.get());

	uv_cond_wait(&channel->_isReady, &channel->_lock);

	LOG(VERBOSE) << "channel: " << id << " opening ...";	
	
	gfx::startup();		

	{
		std::shared_ptr<gfx::Context> ctx;

      std::stringstream title;
      title << PRODUCT << " | " << "channel: " << channel->id();

#ifdef _WIN32
		auto window = win::Window::create(title.str(), channel);

		ctx = gfx::Context::create(window->handle());

		window->show();
		window->update();
#else

#ifdef _RASPI
      auto window = rpi::Window::create();

		ctx = gfx::Context::create(window->handle());
#endif

#endif
		

		LOG(DEBUG) << "channel: staring rendering loop ...";

		uint32_t frame = 0;

		int64_t freq = hires_frequency();
		int64_t now, mark = hires_time();
{'fraction_non_alphanumeric': 0.17884729649435532, 'fraction_numerical': 0.012477718360071301, 'mean_word_length': 4.574503311258278, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 27, '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': '4188581', 'n_tokens_mistral': 1411, 'n_tokens_neox': 1287, 'n_words': 238}