<commit_before>/* Utility program. Convert input into a format that the spiking-visualizer can
 * easily use. */

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

int format(void)
{
  char line[LINE_MAX];
  int time = 0;
  float value;

  while (fgets(line, LINE_MAX, stdin) != NULL) {
    value = strtof(line, NULL);

    printf("[%d, %10f],\n", time, value);

    time++;
  }

  return 0;
}

int main(void)
{
  format();

  return 0;<commit_msg>./build/format supports evaluating integers<commit_after>/* Utility program. Convert input into a format that the spiking-visualizer can
 * easily use. */

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

int format(bool integer_type)
{
  char line[LINE_MAX];
  int time = 0, value_i;
  float value_f;

  while (fgets(line, LINE_MAX, stdin) != NULL) {
    if (integer_type) {
      value_i = strtol(line, NULL, 0);
      printf("[%d, %10d],\n", time, value_i);
    } else {
      value_f = strtof(line, NULL);
      printf("[%d, %10f],\n", time, value_f);
    }


    time++;
  }

  return 0;
}

int main(int argc, char *argv[])
{
  if (argc > 1 && argv[1][0] == 'h') {
    printf("Usage: \n\n\
    ./test/build/<some-test> | ./build/format [arg] > a.js\n\n\
    * No argument, evaluate as floats.\n\
    * Any argument other than 'help', evaluate as integers.\n\
    * 'help', display this message\n\n");
    return 0;
  }

  if (argc != 1) { // Some argument supplied
    format(true);
  } else {
    format(false);
  }

  return 0;
{'fraction_non_alphanumeric': 0.16899534264803726, 'fraction_numerical': 0.011976047904191617, 'mean_word_length': 2.9064935064935065, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 12, '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': '1401302', 'n_tokens_mistral': 589, 'n_tokens_neox': 551, 'n_words': 154}