<commit_before>/* This file generates the #defines needed for Fortran examples of PAPI.
Its output is usually directed to fpapi.h. See Makefile.inc for details. */

#include "papi_test.h"
#include "papiStrings.h"
#undef NDEBUG
#include <assert.h>

/*
	The following 4 arrays are used to create a series of defines
	for use with PAPI in Fortran programs.
	The first and third contain the string names of the defines.
	The second and fourth contain the integer values associated with the names.
	These arrays MUST be kept synchonized. Sizes are computed automagically.
*/

const char *papi_defNam[] = {
  "PAPI_NULL",
  "PAPI_VER_CURRENT",
  "PAPI_DOM_USER",
  "PAPI_DOM_KERNEL",
  "PAPI_DOM_OTHER",
  "PAPI_DOM_ALL",
  "PAPI_STOPPED",
  "PAPI_RUNNING",
  "PAPI_OVERFLOWING",
  "PAPI_PROFILING",
  "PAPI_QUIET",
  "PAPI_VERB_ECONT",
  "PAPI_VERB_ESTOP",
  "PAPI_MAX_STR_LEN",
  "PAPI_NUM_ERRORS"
};

const int papi_defNum[] = {
  PAPI_NULL,
  PAPI_VER_CURRENT,
  PAPI_DOM_USER,
  PAPI_DOM_KERNEL,
  PAPI_DOM_OTHER,
  PAPI_DOM_ALL,
  PAPI_STOPPED,
  PAPI_RUNNING,
  PAPI_OVERFLOWING,
  PAPI_PROFILING,
  PAPI_QUIET,
  PAPI_VERB_ECONT,
  PAPI_VERB_ESTOP,
  PAPI_MAX_STR_LEN,
  PAPI_NUM_ERRORS
};

const char *papi_errNam[] = {
  PAPI_OK_nm,
  PAPI_EINVAL_nm,
  PAPI_ENOMEM_nm,
  PAPI_ESYS_nm,
  PAPI_ESBSTR_nm,
  PAPI_ECLOST_nm,
  PAPI_EBUG_nm,
  PAPI_ENOEVNT_nm,
  PAPI_ECNFLCT_nm,
  PAPI_ENOTRUN_nm,
  PAPI_EISRUN_nm,
  PAPI_ENOEVST_nm,
  PAPI_ENOTPRESET_nm,
  PAPI_ENOCNTR_nm,
  PAPI_EMISC_nm 
};

const int papi_errNum[] = {
  PAPI_OK,
  PAPI_EINVAL,
  PAPI_ENOMEM,
  PAPI_ESYS,
  PAPI_ESBSTR,
  PAPI_ECLOST,
  PAPI_EBUG,
  PAPI_ENOEVNT,
  PAPI_ECNFLCT,
  PAPI_ENOTRUN,
  PAPI_EISRUN,
  PAPI_ENOEVST,
  PAPI_ENOTPRESET,
  PAPI_ENOCNTR,
  PAPI_EMISC 
};

static void define_val(const char *val_string, int val)
{
      printf("#define %-18s % d\n",val_string,val);
}

int main(int argc, char **argv) 
{
  int i,j;
  const PAPI_preset_info_t *info = NULL;

  assert(info = PAPI_query_all_events_verbose());

  /* print a file header block */
  printf("C\nC\tThis file contains defines required by the PAPI Fortran interface.\n");
  printf("C\tIt is automagically generated by genpapifdef.c\n");
  printf("C\tDO NOT modify its contents and expect the changes to stick.\n");
  printf("C\tChanges MUST be made in genpapifdef.c instead.\nC\n\n");

  /* compute the size of the predefined general purpose arrays */
  j = sizeof(papi_defNum)/sizeof(int);

  /* create defines for each line in the arrays */
  printf("\nC\nC\tGeneral purpose defines.\nC\n\n");
  for (i=0;i<j;i++)
      define_val(papi_defNam[i],papi_defNum[i]);

  /* compute the size of the predefined error arrays */
  j = sizeof(papi_errNum)/sizeof(int);

  /* create defines for each line in the arrays */
  printf("\nC\nC\tError defines.\nC\n\n");
  for (i=0;i<j;i++)
      define_val(papi_errNam[i],papi_errNum[i]);

  /* create defines for each member of the PRESET array */
  printf("\nC\nC\tPAPI preset event values.\nC\n\n");
  for (i=0;i<PAPI_MAX_PRESET_EVENTS;i++)
    if (info[i].event_name)
      define_val(info[i].event_name,info[i].event_code);

/* on Windows, the exit generates an unwanted prompt line */
#ifndef _WIN32
  exit(0);
#endif
}

<commit_msg>Removed reference to papi_test.h, since it introduced pathing problems in the Makefile. Someday, I need to learn how to fix the pathing instead... At least it works again. Sorry Nils<commit_after>/* This file generates the #defines needed for Fortran examples of PAPI.
Its output is usually directed to fpapi.h. See Makefile.inc for details. */

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

  /* Windows doesn't have a unistd.h */
#ifndef _WIN32
  #include <unistd.h>
#endif

#include <errno.h>
#include <sys/types.h>
#include <memory.h>
#include <malloc.h>
#include "papiStdEventDefs.h"
#include "papi.h"
#include "papiStrings.h"
#undef NDEBUG
#include <assert.h>

/*
	The following 4 arrays are used to create a series of defines
	for use with PAPI in Fortran programs.
	The first and third contain the string names of the defines.
	The second and fourth contain the integer values associated with the names.
	These arrays MUST be kept synchonized. Sizes are computed automagically.
*/

const char *papi_defNam[] = {
  "PAPI_NULL",
  "PAPI_VER_CURRENT",

  "PAPI_DOM_USER",
  "PAPI_DOM_KERNEL",
  "PAPI_DOM_OTHER",
  "PAPI_DOM_ALL",
  "PAPI_DOM_MIN",
  "PAPI_DOM_MAX",
  "PAPI_DOM_HWSPEC", 

  "PAPI_STOPPED",
  "PAPI_RUNNING",
  "PAPI_OVERFLOWING",
  "PAPI_PROFILING",

  "PAPI_QUIET",
  "PAPI_VERB_ECONT",
  "PAPI_VERB_ESTOP",

  "PAPI_MAX_STR_LEN",
  "PAPI_NUM_ERRORS",

  "PAPI_SET_DEBUG",
  "PAPI_GET_DEBUG",
  "PAPI_SET_DEFDOM",
  "PAPI_GET_DEFDOM",
  "PAPI_SET_DOMAIN",
  "PAPI_GET_DOMAIN",
  "PAPI_SET_DEFGRN",
  "PAPI_GET_DEFGRN",
  "PAPI_SET_GRANUL",
  "PAPI_GET_GRANUL",
  "PAPI_SET_INHERIT",
  "PAPI_GET_INHERIT",

  "PAPI_GRN_THR",
  "PAPI_GRN_MIN",
  "PAPI_GRN_PROC",
  "PAPI_GRN_PROCG ",
  "PAPI_GRN_SYS",
  "PAPI_GRN_SYS_CPU",
  "PAPI_GRN_MAX",

  "PAPI_PROFIL_POSIX",
  "PAPI_PROFIL_RANDOM",
  "PAPI_PROFIL_WEIGHTED",
  "PAPI_PROFIL_COMPRESS"
};

const int papi_defNum[] = {
  PAPI_NULL,
  PAPI_VER_CURRENT,

  PAPI_DOM_USER,
  PAPI_DOM_KERNEL,
  PAPI_DOM_OTHER,
  PAPI_DOM_ALL,
  PAPI_DOM_MIN,
  PAPI_DOM_MAX,
  PAPI_DOM_HWSPEC, 

  PAPI_STOPPED,
  PAPI_RUNNING,
  PAPI_OVERFLOWING,
  PAPI_PROFILING,
  PAPI_QUIET,
  PAPI_VERB_ECONT,
  PAPI_VERB_ESTOP,

  PAPI_MAX_STR_LEN,
  PAPI_NUM_ERRORS,

  PAPI_SET_DEBUG,
  PAPI_GET_DEBUG,
  PAPI_SET_DEFDOM,
  PAPI_GET_DEFDOM,
  PAPI_SET_DOMAIN,
  PAPI_GET_DOMAIN,
  PAPI_SET_DEFGRN,
  PAPI_GET_DEFGRN,
  PAPI_SET_GRANUL,
  PAPI_GET_GRANUL,
  PAPI_SET_INHERIT,
  PAPI_GET_INHERIT,

  PAPI_GRN_THR,
  PAPI_GRN_MIN,
  PAPI_GRN_PROC,
  PAPI_GRN_PROCG ,
  PAPI_GRN_SYS,
  PAPI_GRN_SYS_CPU,
  PAPI_GRN_MAX,

  PAPI_PROFIL_POSIX,
  PAPI_PROFIL_RANDOM,
  PAPI_PROFIL_WEIGHTED,
  PAPI_PROFIL_COMPRESS
};

const char *papi_errNam[] = {
  PAPI_OK_nm,
  PAPI_EINVAL_nm,
  PAPI_ENOMEM_nm,
  PAPI_ESYS_nm,
  PAPI_ESBSTR_nm,
  PAPI_ECLOST_nm,
  PAPI_EBUG_nm,
  PAPI_ENOEVNT_nm,
  PAPI_ECNFLCT_nm,
  PAPI_ENOTRUN_nm,
  PAPI_EISRUN_nm,
  PAPI_ENOEVST_nm,
  PAPI_ENOTPRESET_nm,
  PAPI_ENOCNTR_nm,
  PAPI_EMISC_nm 
};

const int papi_errNum[] = {
  PAPI_OK,
  PAPI_EINVAL,
  PAPI_ENOMEM,
  PAPI_ESYS,
  PAPI_ESBSTR,
  PAPI_ECLOST,
  PAPI_EBUG,
  PAPI_ENOEVNT,
  PAPI_ECNFLCT,
  PAPI_ENOTRUN,
  PAPI_EISRUN,
  PAPI_ENOEVST,
  PAPI_ENOTPRESET,
  PAPI_ENOCNTR,
  PAPI_EMISC 
};

static void define_val(const char *val_string, int val)
{
      printf("#define %-18s % d\n",val_string,val);
}

int main(int argc, char **argv) 
{
  int i,j;
  const PAPI_preset_info_t *info = NULL;

  assert(info = PAPI_query_all_events_verbose());

  /* print a file header block */
  printf("C\nC\tThis file contains defines required by the PAPI Fortran interface.\n");
  printf("C\tIt is automagically generated by genpapifdef.c\n");
  printf("C\tDO NOT modify its contents and expect the changes to stick.\n");
  printf("C\tChanges MUST be made in genpapifdef.c instead.\nC\n\n");

  /* compute the size of the predefined general purpose arrays */
  j = sizeof(papi_defNum)/sizeof(int);

  /* create defines for each line in the general arrays */
  printf("\nC\nC\tGeneral purpose defines.\nC\n\n");
  for (i=0;i<j;i++)
      define_val(papi_defNam[i],papi_defNum[i]);

  /* compute the size of the predefined error arrays */
  j = sizeof(papi_errNum)/sizeof(int);

  /* create defines for each line in the error arrays */
  printf("\nC\nC\tError defines.\nC\n\n");
  for (i=0;i<j;i++)
      define_val(papi_errNam[i],papi_errNum[i]);

  /* create defines for each member of the PRESET array */
  printf("\nC\nC\tPAPI preset event values.\nC\n\n");
  for (i=0;i<PAPI_MAX_PRESET_EVENTS;i++)
    if (info[i].event_name)
      define_val(info[i].event_name,info[i].event_code);

  exit(0);
}


{'fraction_non_alphanumeric': 0.10993495727585767, 'fraction_numerical': 0.002295625557964545, 'mean_word_length': 4.259557344064386, 'pattern_counts': {'":': 0, '<': 18, '<?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': '6672906', 'n_tokens_mistral': 3425, 'n_tokens_neox': 3378, 'n_words': 687}