<commit_before>/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkParseMain.c

  Copyright (c) <NAME>, <NAME>, <NAME>
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/

/*

This file provides a unified front-end for the wrapper generators.
It contains the main() function and argument parsing, and calls
the code that parses the header file.

*/

#include "vtkParse.h"
#include "vtkParseMain.h"
#include "vtkParseInternal.h"
#include "vtkConfigure.h" // VTK_VERSION
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>

/* This is the struct that contains the options */
OptionInfo options;
int help = 0;
int version = 0;

/* This method provides the back-end for the generators */
extern void vtkParseOutput(FILE *, FileInfo *);

/* Check the options */
static int check_options(int argc, char *argv[])
{
  int i;
  size_t j;

  options.InputFileName = NULL;
  options.OutputFileName = NULL;
  options.IsAbstract = 0;
  options.IsConcrete = 0;
  options.IsVTKObject = 0;
  options.IsSpecialObject = 0;
  options.HierarchyFileName = 0;
  options.HintFileName = 0;

  for (i = 1; i < argc && argv[i][0] == '-'; i++)
    {
    if (strcmp(argv[i], "--concrete") == 0)
      {
      options.IsConcrete = 1;
      }
    else if (strcmp(argv[i], "--abstract") == 0)
      {
      options.IsAbstract = 1;
      }
    else if (strcmp(argv[i], "--vtkobject") == 0)
      {
      options.IsVTKObject = 1;
      }
    else if (strcmp(argv[i], "--special") == 0)
      {
      options.IsSpecialObject = 1;
      }
    else if (strcmp(argv[i], "--hints") == 0)
      {
      i++;
      if (i >= argc || argv[i][0] == '-')
        {
        return -1;
        }
      options.HintFileName = argv[i];
      }
    else if (strcmp(argv[i], "--types") == 0)
      {
      i++;
      if (i >= argc || argv[i][0] == '-')
        {
        return -1;
        }
      options.HierarchyFileName = argv[i];
      }
    else if (strcmp(argv[i], "-I") == 0)
      {
      i++;
      if (i >= argc || argv[i][0] == '-')
        {
        return -1;
        }
      vtkParse_IncludeDirectory(argv[i]);
      }
    else if (strcmp(argv[i], "-D") == 0)
      {
      i++;
      j = 0;
      if (i >= argc || argv[i][0] == '-')
        {
        return -1;
        }
      while (argv[i][j] != '\0' && argv[i][j] != '=') { j++; }
      if (argv[i][j] == '=') { j++; }
      vtkParse_DefineMacro(argv[i], &argv[i][j]);
      }
    else if (strcmp(argv[i], "-U") == 0)
      {
      i++;
      if (i >= argc || argv[i][0] == '-')
        {
        return -1;
        }
      vtkParse_UndefineMacro(argv[i]);
      }
    else if (strcmp(argv[i], "--help") == 0)
      {
      help = 1;
      }
    else if (strcmp(argv[i], "--version") == 0)
      {
      version = 1;
      }
    }

  return i;
}

/* Return a pointer to the static OptionInfo struct */
OptionInfo *vtkParse_GetCommandLineOptions()
{
  return &options;
}

static void print_help(FILE *stream, const char *cmd)
{
  fprintf(stream,
    "Usage: %s [options] input_file output_file\n"
    "  --concrete      force concrete class\n"
    "  --abstract      force abstract class\n"
    "  --vtkobject     vtkObjectBase-derived class\n"
    "  --special       non-vtkObjectBase class\n"
    "  --hints <file>  hints file\n"
    "  --types <file>  type hierarchy file\n"
    "  -I <dir>        add an include directory\n"
    "  -D <macro>      define a preprocessor macro\n",
    cmd);
}

int main(int argc, char *argv[])
{
  int argi;
  int has_options = 0;
  FILE *ifile;
  FILE *ofile;
  FILE *hfile = 0;
  const char *cp;
  char *classname;
  size_t i;
  FileInfo *data;<commit_msg>STYLE: Add a bit to the documentation.<commit_after>/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkParseMain.c

  Copyright (c) <NAME>, <NAME>, <NAME>
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/

/*

This file provides a unified front-end for the wrapper generators.
It contains the main() function and argument parsing, and calls
the code that parses the header file.

*/

#include "vtkParse.h"
#include "vtkParseMain.h"
#include "vtkParseInternal.h"
#include "vtkConfigure.h" // VTK_VERSION
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>

/* This is the struct that contains the options */
OptionInfo options;
int help = 0;
int version = 0;

/* This method provides the back-end for the generators */
extern void vtkParseOutput(FILE *, FileInfo *);

/* Check the options */
static int check_options(int argc, char *argv[])
{
  int i;
  size_t j;

  options.InputFileName = NULL;
  options.OutputFileName = NULL;
  options.IsAbstract = 0;
  options.IsConcrete = 0;
  options.IsVTKObject = 0;
  options.IsSpecialObject = 0;
  options.HierarchyFileName = 0;
  options.HintFileName = 0;

  for (i = 1; i < argc && argv[i][0] == '-'; i++)
    {
    if (strcmp(argv[i], "--concrete") == 0)
      {
      options.IsConcrete = 1;
      }
    else if (strcmp(argv[i], "--abstract") == 0)
      {
      options.IsAbstract = 1;
      }
    else if (strcmp(argv[i], "--vtkobject") == 0)
      {
      options.IsVTKObject = 1;
      }
    else if (strcmp(argv[i], "--special") == 0)
      {
      options.IsSpecialObject = 1;
      }
    else if (strcmp(argv[i], "--hints") == 0)
      {
      i++;
      if (i >= argc || argv[i][0] == '-')
        {
        return -1;
        }
      options.HintFileName = argv[i];
      }
    else if (strcmp(argv[i], "--types") == 0)
      {
      i++;
      if (i >= argc || argv[i][0] == '-')
        {
        return -1;
        }
      options.HierarchyFileName = argv[i];
      }
    else if (strcmp(argv[i], "-I") == 0)
      {
      i++;
      if (i >= argc || argv[i][0] == '-')
        {
        return -1;
        }
      vtkParse_IncludeDirectory(argv[i]);
      }
    else if (strcmp(argv[i], "-D") == 0)
      {
      i++;
      j = 0;
      if (i >= argc || argv[i][0] == '-')
        {
        return -1;
        }
      while (argv[i][j] != '\0' && argv[i][j] != '=') { j++; }
      if (argv[i][j] == '=') { j++; }
      vtkParse_DefineMacro(argv[i], &argv[i][j]);
      }
    else if (strcmp(argv[i], "-U") == 0)
      {
      i++;
      if (i >= argc || argv[i][0] == '-')
        {
        return -1;
        }
      vtkParse_UndefineMacro(argv[i]);
      }
    else if (strcmp(argv[i], "--help") == 0)
      {
      help = 1;
      }
    else if (strcmp(argv[i], "--version") == 0)
      {
      version = 1;
      }
    }

  return i;
}

/* Return a pointer to the static OptionInfo struct */
OptionInfo *vtkParse_GetCommandLineOptions()
{
  return &options;
}

static void print_help(FILE *stream, const char *cmd)
{
  fprintf(stream,
    "Usage: %s [options] input_file output_file\n"
    "  --concrete      force concrete class\n"
    "  --abstract      force abstract class\n"
    "  --vtkobject     vtkObjectBase-derived class\n"
    "  --special       non-vtkObjectBase class\n"
    "  --hints <file>  the hints file to use\n"
    "  --types <file>  the type hierarchy file to use\n"
    "  -I <dir>        add an include directory\n"
    "  -D <macro>      define a preprocessor macro\n"
    "  -U <macro>      undefine a preprocessor macro\n",
    cmd);
}

int main(int argc, char *argv[])
{
  int argi;
  int has_options = 0;
  FILE *ifile;
  FILE *ofile;
  FILE *hfile = 0;
  const char *cp;
  char *classname;
  size_t i;
  FileInfo *data;
{'fraction_non_alphanumeric': 0.1887114470315738, 'fraction_numerical': 0.009996342801414117, 'mean_word_length': 2.3014084507042254, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2450374', 'n_tokens_mistral': 2837, 'n_tokens_neox': 2749, 'n_words': 745}