<commit_before>#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#undef Fflush
#undef Mkdir
#undef Stat

#if 0
#include "../config.h"
#ifdef HAVE_BEECRYPT_API_H
#include <beecrypt/api.h>
#endif
#endif

#include "rpmlib.h"
#include "rpmfi.h"
#include "rpmio_internal.h"
#include "rpmpgp.h"

MODULE = RPM::Files		PACKAGE = RPM::Files

PROTOTYPES: ENABLE

rpmfi
new(class, header, ts = NULL)
    char * class
    Header header
    rpmts ts
    CODE:
    RETVAL = rpmfiNew(ts, header, RPMTAG_BASENAMES, 0);
    OUTPUT:
    RETVAL

void
DESTROY(Files)
    rpmfi Files
    PPCODE:
    Files = rpmfiFree(Files);

int
count(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFC(Files);
    OUTPUT:
    RETVAL

void
init(Files)
    rpmfi Files
    CODE:
    rpmfiInit(Files, 0);

char *
next(Files)
    rpmfi Files
    PREINIT:
    char val[16];
    int idx = 0;
    CODE:
    if ((idx = rpmfiNext(Files)) == -1) {
        RETVAL = NULL;
    } else {
        snprintf(val, 12, idx == 0 ? "%dE0" : "%d", idx);
        RETVAL = val;
    }
    OUTPUT:
    RETVAL

int
count_dir(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiDC(Files);
    OUTPUT:
    RETVAL


void
init_dir(Files)
    rpmfi Files
    CODE:
    rpmfiInitD(Files, 0);

char *
next_dir(Files)
    rpmfi Files
    PREINIT:
    char val[16];
    int idx = 0;
    CODE:
    if ((idx = rpmfiNextD(Files)) == -1) {
        RETVAL = NULL;
    } else {
        snprintf(val, 12, idx == 0 ? "%dE0" : "%d", idx);
        RETVAL = val;
    }
    OUTPUT:
    RETVAL

int
_compare(Files, Fb)
    rpmfi Files
    rpmfi Fb
    CODE:
    RETVAL = rpmfiCompare(Files, Fb);
    OUTPUT:
    RETVAL
        
const char *
filename(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFN(Files);
    OUTPUT:
    RETVAL

const char *
dirname(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiDN(Files);
    OUTPUT:
    RETVAL

const char *
basename(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiBN(Files);
    OUTPUT:
    RETVAL

unsigned int
fflags(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFFlags(Files);
    OUTPUT:
    RETVAL

unsigned int
mode(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFMode(Files);
    OUTPUT:
    RETVAL

void
digest(Files)
    rpmfi Files
    PREINIT:
    const unsigned char * digest;
    int algop = 0;
    size_t lenp = 0;
    PPCODE:
    if ((digest = rpmfiDigest(Files, &algop, &lenp)) != NULL
        /* return undef if empty */) {
        if (lenp) {
        XPUSHs(sv_2mortal(newSVpv(digest, lenp)));
        XPUSHs(sv_2mortal(newSViv(algop)));
        }
    }

const char *
link(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFLink(Files);
    OUTPUT:
    RETVAL

const char *
user(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFUser(Files);
    OUTPUT:
    RETVAL

const char *
group(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFGroup(Files);
    OUTPUT:
    RETVAL

int
inode(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFInode(Files);
    OUTPUT:
    RETVAL
    
int
size(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFSize(Files);
    OUTPUT:
    RETVAL

int
dev(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFRdev(Files);
    OUTPUT:
    RETVAL

int
color(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFColor(Files);
    OUTPUT:
    RETVAL

const char *
class(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFClass(Files);
    OUTPUT:
    RETVAL

int
mtime(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFMtime(Files);
    OUTPUT:
    RETVAL

int
_nlink(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFNlink(Files);
    OUTPUT:
    RETVAL

<commit_msg>- include again beecrypt/api.h for mac ports<commit_after>#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#undef Fflush
#undef Mkdir
#undef Stat

#include "../config.h"
#ifdef HAVE_BEECRYPT_API_H
#include <beecrypt/api.h>
#endif

#include "rpmlib.h"
#include "rpmfi.h"
#include "rpmio_internal.h"
#include "rpmpgp.h"

MODULE = RPM::Files		PACKAGE = RPM::Files

PROTOTYPES: ENABLE

rpmfi
new(class, header, ts = NULL)
    char * class
    Header header
    rpmts ts
    CODE:
    RETVAL = rpmfiNew(ts, header, RPMTAG_BASENAMES, 0);
    OUTPUT:
    RETVAL

void
DESTROY(Files)
    rpmfi Files
    PPCODE:
    Files = rpmfiFree(Files);

int
count(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFC(Files);
    OUTPUT:
    RETVAL

void
init(Files)
    rpmfi Files
    CODE:
    rpmfiInit(Files, 0);

char *
next(Files)
    rpmfi Files
    PREINIT:
    char val[16];
    int idx = 0;
    CODE:
    if ((idx = rpmfiNext(Files)) == -1) {
        RETVAL = NULL;
    } else {
        snprintf(val, 12, idx == 0 ? "%dE0" : "%d", idx);
        RETVAL = val;
    }
    OUTPUT:
    RETVAL

int
count_dir(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiDC(Files);
    OUTPUT:
    RETVAL


void
init_dir(Files)
    rpmfi Files
    CODE:
    rpmfiInitD(Files, 0);

char *
next_dir(Files)
    rpmfi Files
    PREINIT:
    char val[16];
    int idx = 0;
    CODE:
    if ((idx = rpmfiNextD(Files)) == -1) {
        RETVAL = NULL;
    } else {
        snprintf(val, 12, idx == 0 ? "%dE0" : "%d", idx);
        RETVAL = val;
    }
    OUTPUT:
    RETVAL

int
_compare(Files, Fb)
    rpmfi Files
    rpmfi Fb
    CODE:
    RETVAL = rpmfiCompare(Files, Fb);
    OUTPUT:
    RETVAL
        
const char *
filename(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFN(Files);
    OUTPUT:
    RETVAL

const char *
dirname(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiDN(Files);
    OUTPUT:
    RETVAL

const char *
basename(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiBN(Files);
    OUTPUT:
    RETVAL

unsigned int
fflags(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFFlags(Files);
    OUTPUT:
    RETVAL

unsigned int
mode(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFMode(Files);
    OUTPUT:
    RETVAL

void
digest(Files)
    rpmfi Files
    PREINIT:
    const unsigned char * digest;
    int algop = 0;
    size_t lenp = 0;
    PPCODE:
    if ((digest = rpmfiDigest(Files, &algop, &lenp)) != NULL
        /* return undef if empty */) {
        if (lenp) {
        XPUSHs(sv_2mortal(newSVpv(digest, lenp)));
        XPUSHs(sv_2mortal(newSViv(algop)));
        }
    }

const char *
link(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFLink(Files);
    OUTPUT:
    RETVAL

const char *
user(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFUser(Files);
    OUTPUT:
    RETVAL

const char *
group(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFGroup(Files);
    OUTPUT:
    RETVAL

int
inode(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFInode(Files);
    OUTPUT:
    RETVAL
    
int
size(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFSize(Files);
    OUTPUT:
    RETVAL

int
dev(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFRdev(Files);
    OUTPUT:
    RETVAL

int
color(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFColor(Files);
    OUTPUT:
    RETVAL

const char *
class(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFClass(Files);
    OUTPUT:
    RETVAL

int
mtime(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFMtime(Files);
    OUTPUT:
    RETVAL

int
_nlink(Files)
    rpmfi Files
    CODE:
    RETVAL = rpmfiFNlink(Files);
    OUTPUT:
    RETVAL


{'fraction_non_alphanumeric': 0.10645071982281284, 'fraction_numerical': 0.00650609080841639, 'mean_word_length': 2.279618701770313, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3346435', 'n_tokens_mistral': 3009, 'n_tokens_neox': 2741, 'n_words': 683}