<commit_before>#include <display.h>
#include <assert.h>
#include <stdlib.h>

#define min(a,b) ((a)>(b)?(b):(a))

WINDOW *main_screen;

/* private functions */
void init_colors(void);

void init_screen(void){
  main_screen = initscr();
  keypad(stdscr, TRUE);           // keypad enabled
  (void) nodelay(main_screen, 1); // no blocking
  (void) noecho();                // don't print to screen
  (void) nonl();                  // no new lines
  init_colors();
}

/*
 * crazy shifting is to set up every color 
 */
void init_colors(void) {
  int i;
  start_color();
  if (COLORS < 255) {
    for (i = 0; i < (1 << 8); i ++) {
      init_pair(i, 255, 0); // 0 --> i if you want pure blocks, otherwise ascii
    }
  } else {
    for (i = 0; i < (1 << 8); i ++) {
      init_pair(i, i, 0); // 0 --> i if you want pure blocks, otherwise ascii
    }
  }
  return;
}

void end_screen(void) {
  endwin();
}

/* allow us to directly map to the 216 colors ncurses makes available */
static inline int get_color(int r, int g, int b) {
  return 16+r/48*36+g/48*6+b/48;
}

const char ascii_values[] = " ..::--==+++***###%%%%%%%%@@@@@@@";

int draw_line(char *data, int width, int y, int channels) {
  int j;
  unsigned char b, g, r;
  int intensity;
  for (j = 0; j < width; j++){
    b = data[j * channels];
    g = data[j * channels + 1];
    r = data[j * channels + 2];
    intensity = (sizeof(ascii_values) - 1) * ((r/255.0 + g/255.0 + b/255.0) / 3);
    char val = ascii_values[intensity];
    int color = get_color(r, g, b);
    if (COLORS < 255) {
      color = 0;
    }
    mvaddch(y, j, val|COLOR_PAIR(color));
  } 

  refresh();
  return 0;
}

int write_bandwidth(char *bandstr, int bandlen, int width, int height) {
  int i;

  if (width < bandlen) {<commit_msg>Initiate braille display<commit_after>#include <display.h>
#include <assert.h>
#include <stdlib.h>

#define min(a,b) ((a)>(b)?(b):(a))

WINDOW *main_screen;

/* private functions */
void init_colors(void);

void init_screen(void){
  main_screen = initscr();
  keypad(stdscr, TRUE);           // keypad enabled
  (void) nodelay(main_screen, 1); // no blocking
  (void) noecho();                // don't print to screen
  (void) nonl();                  // no new lines
  init_colors();
}

/*
 * crazy shifting is to set up every color 
 */
void init_colors(void) {
  int i;
  start_color();
  if (COLORS < 255) {
    for (i = 0; i < (1 << 8); i ++) {
      init_pair(i, 255, 0); // 0 --> i if you want pure blocks, otherwise ascii
    }
  } else {
    for (i = 0; i < (1 << 8); i ++) {
      init_pair(i, i, 0); // 0 --> i if you want pure blocks, otherwise ascii
    }
  }
  return;
}

void end_screen(void) {
  endwin();
}

/* allow us to directly map to the 216 colors ncurses makes available */
static inline int get_color(int r, int g, int b) {
  return 16+r/48*36+g/48*6+b/48;
}

const char ascii_values[] = " ..::--==+++***###%%%%%%%%@@@@@@@";

int draw_braille(char *data, int width, int height, int channels) {
  // Let the magic begin.
}

int draw_line(char *data, int width, int y, int channels) {
  int j;
  unsigned char b, g, r;
  int intensity;
  for (j = 0; j < width; j++){
    b = data[j * channels];
    g = data[j * channels + 1];
    r = data[j * channels + 2];
    intensity = (sizeof(ascii_values) - 1) * ((r/255.0 + g/255.0 + b/255.0) / 3);
    char val = ascii_values[intensity];
    int color = get_color(r, g, b);
    if (COLORS < 255) {
      color = 0;
    }
    mvaddch(y, j, val|COLOR_PAIR(color));
  } 

  refresh();
  return 0;
}

int write_bandwidth(char *bandstr, int bandlen, int width, int height) {
  int i;

  if (width < bandlen) {
{'fraction_non_alphanumeric': 0.1781387665198238, 'fraction_numerical': 0.02918502202643172, 'mean_word_length': 2.6586102719033233, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 15, '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': '6028609', 'n_tokens_mistral': 1473, 'n_tokens_neox': 1360, 'n_words': 415}