<commit_before>/* This is a very simple example of how to use the PipLib inside your programs.
 * You should compile it by typing 'make' (after edition of the makefile), then
 * test it for instance by typing 'more FILE.pol | ./example'. Finally you can
 * compare results given by PIP by typing 'pip32 FILE.dat'
 */

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <piplib/piplib.h>

static PipOptions *options_read(FILE *f)
{
  char s[1024];
  PipOptions *options = pip_options_init();
  while (fgets(s, 1024, f)) {
    if (strncasecmp(s, "Maximize", 8) == 0)
      options->Maximize = 1;
    if (strncasecmp(s, "Urs_parms", 9) == 0)
      options->Urs_parms = 1;
    if (strncasecmp(s, "Urs_unknowns", 12) == 0)
      options->Urs_unknowns = 1;
  }
  return options;
}

int main(int argc, const char **argv)
{ int bignum ;
  PipMatrix  * domain, * context  ;
  PipQuast   * solution ;
  PipOptions * options ;
  int verbose = 0;

  while (argc > 1) {
    if (strncmp(argv[1], "-v", 2) == 0) {
      const char *v = argv[1]+2;
      ++verbose;
      while (*v++ == 'v')
	++verbose;
    } else
      break;
    ++argv;
    --argc;
  }
  
  printf("[PIP2-like future input] Please enter:\n- the context matrix,\n") ;
  context = pip_matrix_read(stdin) ;
  pip_matrix_print(stdout,context) ;

  printf("- the bignum column (start at 0, -1 if no bignum),\n") ;
  fscanf(stdin," %d",&bignum) ;<commit_msg>example: allow computation of rational optimum<commit_after>/* This is a very simple example of how to use the PipLib inside your programs.
 * You should compile it by typing 'make' (after edition of the makefile), then
 * test it for instance by typing 'more FILE.pol | ./example'. Finally you can
 * compare results given by PIP by typing 'pip32 FILE.dat'
 */

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <piplib/piplib.h>

static PipOptions *options_read(FILE *f)
{
  char s[1024];
  PipOptions *options = pip_options_init();
  while (fgets(s, 1024, f)) {
    if (strncasecmp(s, "Maximize", 8) == 0)
      options->Maximize = 1;
    if (strncasecmp(s, "Urs_parms", 9) == 0)
      options->Urs_parms = 1;
    if (strncasecmp(s, "Urs_unknowns", 12) == 0)
      options->Urs_unknowns = 1;
    if (strncasecmp(s, "Rational", 8) == 0)
      options->Nq = 0;
  }
  return options;
}

int main(int argc, const char **argv)
{ int bignum ;
  PipMatrix  * domain, * context  ;
  PipQuast   * solution ;
  PipOptions * options ;
  int verbose = 0;

  while (argc > 1) {
    if (strncmp(argv[1], "-v", 2) == 0) {
      const char *v = argv[1]+2;
      ++verbose;
      while (*v++ == 'v')
	++verbose;
    } else
      break;
    ++argv;
    --argc;
  }
  
  printf("[PIP2-like future input] Please enter:\n- the context matrix,\n") ;
  context = pip_matrix_read(stdin) ;
  pip_matrix_print(stdout,context) ;

  printf("- the bignum column (start at 0, -1 if no bignum),\n") ;
  fscanf(stdin," %d",&bignum) ;
{'fraction_non_alphanumeric': 0.15115489130434784, 'fraction_numerical': 0.021399456521739132, 'mean_word_length': 3.1596045197740112, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 20, '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': '5785569', 'n_tokens_mistral': 1152, 'n_tokens_neox': 1093, 'n_words': 326}