<commit_before>#include <node.h>
#include <string.h>
#include <xcb/xcb.h>
#include <iostream>
#include <functional>
#include "__autogen_events.h"

namespace XCBJS {

using namespace v8;

class Event {
private:
  struct EventData {
    xcb_connection_t *connection;
    xcb_generic_event_t *ev;
  };
public:

  static void Init(Handle<Object> target) {
    HandleScope scope;
    InitXCB2JSEvents(Persistent<Object>::New(target));
  }

  static void EventLoop(xcb_connection_t * connection) {
    eio_custom(LookForEvent, EIO_PRI_DEFAULT, EventObtained, PrepEventData(connection));
    ev_ref(EV_DEFAULT_UC);
  }

  static EventData *PrepEventData(xcb_connection_t *connection) {
    EventData *ev = new EventData;
    ev->connection = connection;
    return ev;
  }

  static int EventObtained(eio_req *req) {
    EventData *ev = static_cast<EventData*>(req->data);
    eio_custom(LookForEvent, EIO_PRI_DEFAULT, EventObtained, PrepEventData(ev->connection));
    distributeEvent(ev->ev);
    delete ev;
    return 0;
  }

  static int LookForEvent(eio_req *req) {
    EventData *ev = static_cast<EventData*>(req->data);
    ev->ev = xcb_wait_for_event(ev->connection);
    return req->result = 0;
  }

};

};<commit_msg>header guards for events.h<commit_after>#ifndef __XCBJS_EVENTS__
#define __XCBJS_EVENTS__

#include <node.h>
#include <string.h>
#include <xcb/xcb.h>
#include <iostream>
#include <functional>
#include "__autogen_events.h"

namespace XCBJS {

using namespace v8;

class Event {
private:
  struct EventData {
    xcb_connection_t *connection;
    xcb_generic_event_t *ev;
  };
public:

  static void Init(Handle<Object> target) {
    HandleScope scope;
    InitXCB2JSEvents(Persistent<Object>::New(target));
  }

  static void EventLoop(xcb_connection_t * connection) {
    eio_custom(LookForEvent, EIO_PRI_DEFAULT, EventObtained, PrepEventData(connection));
    ev_ref(EV_DEFAULT_UC);
  }

  static EventData *PrepEventData(xcb_connection_t *connection) {
    EventData *ev = new EventData;
    ev->connection = connection;
    return ev;
  }

  static int EventObtained(eio_req *req) {
    EventData *ev = static_cast<EventData*>(req->data);
    eio_custom(LookForEvent, EIO_PRI_DEFAULT, EventObtained, PrepEventData(ev->connection));
    distributeEvent(ev->ev);
    delete ev;
    return 0;
  }

  static int LookForEvent(eio_req *req) {
    EventData *ev = static_cast<EventData*>(req->data);
    ev->ev = xcb_wait_for_event(ev->connection);
    return req->result = 0;
  }

};

};

#endif
{'fraction_non_alphanumeric': 0.11863057324840764, 'fraction_numerical': 0.0031847133757961785, 'mean_word_length': 4.5597345132743365, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 37, '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': '5848116', 'n_tokens_mistral': 907, 'n_tokens_neox': 890, 'n_words': 174}