<commit_before>/**
 * Please do not remove the following notices.
 *
 * \file       io_serial.c
 * \author     <NAME> <<EMAIL>>
 * \copyright  (c) 2014-2015 by Geekscape Pty. Ltd.
 * \license    AGPLv3 http://geekscape.org/static/aiko_license.html
 *
 * To Do
 * ~~~~~
 * - None, yet.
 */

#include "../aiko_engine.h"

FILE *readerFile;

int fileGetC() {
  return(getc(readerFile));
}

void fileUngetC(
  int ch) {

  ungetc(ch, readerFile);
}

int fileIsEmpty() {
  int ch = fileGetC();

  if (ch != EOF) fileUngetC(ch);

  return(ch == EOF);
}

tReader reader = { fileGetC, fileIsEmpty, fileUngetC };

/* ------------------------------------------------------------------------- */
tReader *aikoIoInitialize(
  FILE *inputFile) {

  readerFile = inputFile;
  return(& reader);
}

/* ------------------------------------------------------------------------- */<commit_msg>Make unix/io_serial.c a little more consistent with unix/io_buffer.c<commit_after>/**
 * Please do not remove the following notices.
 *
 * \file       io_serial.c
 * \author     <NAME> <<EMAIL>>
 * \copyright  (c) 2014-2015 by Geekscape Pty. Ltd.
 * \license    AGPLv3 http://geekscape.org/static/aiko_license.html
 *
 * To Do
 * ~~~~~
 * - None, yet.
 */

#include "../aiko_engine.h"

FILE *aikoReaderFile;

int fileGetC() {
  return(getc(aikoReaderFile));
}

void fileUngetC(
  int ch) {

  ungetc(ch, aikoReaderFile);
}

int fileIsEmpty() {
  int ch = fileGetC();

  if (ch != EOF) fileUngetC(ch);

  return(ch == EOF);
}

tReader aikoBufferReader = { fileGetC, fileIsEmpty, fileUngetC };

/* ------------------------------------------------------------------------- */
tReader *aikoIoInitialize(
  FILE *inputFile) {

  aikoReaderFile = inputFile;
  return(& aikoBufferReader);
}

/* ------------------------------------------------------------------------- */
{'fraction_non_alphanumeric': 0.2939575394665215, 'fraction_numerical': 0.00979858464888405, 'mean_word_length': 1.7764350453172206, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2832951', 'n_tokens_mistral': 616, 'n_tokens_neox': 605, 'n_words': 135}