<commit_before>
extern "C" {
#include "cx/syscx.h"
}


#include "cx/fileb.hh"
#include "cx/map.hh"
#include "cx/table.hh"
#include "cx/bittable.hh"

#include "../namespace.hh"


OFile& operator<<(OFile& of, const BitTable& bt)
{
  for (zuint i = 0; i < bt.sz(); ++i)
    of << bt[i];
  return of;
}

  void
map_livelock_ppgs(void (*f) (void**, const UniAct&, uint, uint),
                  void** ctx,
                  const Table<PcState>& bot,
                  const Table<PcState>& col,
                  const Table<PcState>& ppgfun,
                  const uint domsz)
{
  const uint n = bot.sz() - 1;
  const uint m = col.sz() - 1;
  Claim( bot[0] == bot[n] );
  Claim( bot[0] == col[m] );<commit_msg>COPY src/uni/classify.cc INTO src/uni/unifile.cc<commit_after>
extern "C" {
#include "cx/syscx.h"
}


#include "cx/fileb.hh"
#include "cx/map.hh"
#include "cx/table.hh"
#include "cx/bittable.hh"

#include "../namespace.hh"


OFile& operator<<(OFile& of, const BitTable& bt)
{
  for (zuint i = 0; i < bt.sz(); ++i)
    of << bt[i];
  return of;
}

static
  bool
xget_triple(C::XFile* xfile, UniAct& act)
{
  C::XFile olay[1];
  if (!getlined_olay_XFile (olay, xfile, "\n"))
    return false;
  uint a, b, c;
  if (xget_uint_XFile (olay, &a)) {
    if (xget_uint_XFile (olay, &b) &&
        xget_uint_XFile (olay, &c)) {
      act = UniAct(a, b, c);
      return true;
    }
    else {
      failout_sysCx("I didn't read a full triple. Malformed input?");
    }
  }
  return false;
}

static
  uint
xget_actions(C::XFile* xfile, Table<UniAct>& acts)
{
  UniAct act;
  while (xget_triple(xfile, act)) {
    acts << act;
  }
  if (acts.sz()==0) {
    failout_sysCx("No actions given! Please provide triples on standard input.");
  }
  uint domsz = 0;
  for (uint i = 0; i < acts.sz(); ++i) {
    for (uint j = 0; j < 3; ++j) {
      if (acts[i][j]+1 > domsz) {
        domsz = acts[i][j]+1;
      }
    }
  }
  return domsz;
}

  void
map_livelock_ppgs(void (*f) (void**, const UniAct&, uint, uint),
                  void** ctx,
                  const Table<PcState>& bot,
                  const Table<PcState>& col,
                  const Table<PcState>& ppgfun,
                  const uint domsz)
{
  const uint n = bot.sz() - 1;
  const uint m = col.sz() - 1;
  Claim( bot[0] == bot[n] );
  Claim( bot[0] == col[m] );
{'fraction_non_alphanumeric': 0.17467811158798283, 'fraction_numerical': 0.007725321888412017, 'mean_word_length': 2.3587896253602305, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 11, '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': '1025273', 'n_tokens_mistral': 974, 'n_tokens_neox': 930, 'n_words': 238}