<commit_before>! (c)2009, 2010 <NAME>, <NAME> bsd license
USING: accessors alien alien.arrays alien.c-types alien.strings
arrays byte-arrays combinators combinators.short-circuit
cpu.architecture fry generalizations io io.streams.memory kernel
libc macros math math.functions parser sequences
stack-checker.dependencies summary words ;
QUALIFIED: math
IN: alien.data

: <ref> ( value c-type -- c-ptr )
    [ heap-size <byte-array> ] keep
    '[ 0 _ set-alien-value ] keep ; inline

: deref ( c-ptr c-type -- value )
    [ 0 ] dip alien-value ; inline

: little-endian? ( -- ? ) 1 int <ref> char deref 1 = ; foldable

GENERIC: c-array-constructor ( c-type -- word ) foldable

GENERIC: c-(array)-constructor ( c-type -- word ) foldable

GENERIC: c-direct-array-constructor ( c-type -- word ) foldable

GENERIC: c-array-type ( c-type -- word ) foldable

GENERIC: c-array-type? ( c-type -- word ) foldable

GENERIC: c-array? ( obj c-type -- ? ) foldable

M: word c-array?
    c-array-type? execute( seq -- array ) ; inline

M: pointer c-array?
    drop void* c-array? ;

GENERIC: >c-array ( seq c-type -- array )

M: word >c-array
    c-array-type new clone-like ;

M: pointer >c-array
    drop void* >c-array ;

GENERIC: <c-array> ( len c-type -- array )

M: word <c-array>
    c-array-constructor execute( len -- array ) ; inline

M: pointer <c-array>
    drop void* <c-array> ;

GENERIC: (c-array) ( len c-type -- array )

M: word (c-array)<commit_msg>alien.data: need to mark ">c-array" inline.<commit_after>! (c)2009, 2010 <NAME>, <NAME> bsd license
USING: accessors alien alien.arrays alien.c-types alien.strings
arrays byte-arrays combinators combinators.short-circuit
cpu.architecture fry generalizations io io.streams.memory kernel
libc macros math math.functions parser sequences
stack-checker.dependencies summary words ;
QUALIFIED: math
IN: alien.data

: <ref> ( value c-type -- c-ptr )
    [ heap-size <byte-array> ] keep
    '[ 0 _ set-alien-value ] keep ; inline

: deref ( c-ptr c-type -- value )
    [ 0 ] dip alien-value ; inline

: little-endian? ( -- ? ) 1 int <ref> char deref 1 = ; foldable

GENERIC: c-array-constructor ( c-type -- word ) foldable

GENERIC: c-(array)-constructor ( c-type -- word ) foldable

GENERIC: c-direct-array-constructor ( c-type -- word ) foldable

GENERIC: c-array-type ( c-type -- word ) foldable

GENERIC: c-array-type? ( c-type -- word ) foldable

GENERIC: c-array? ( obj c-type -- ? ) foldable

M: word c-array?
    c-array-type? execute( seq -- array ) ; inline

M: pointer c-array?
    drop void* c-array? ;

GENERIC: >c-array ( seq c-type -- array )

M: word >c-array
    c-array-type new clone-like ; inline

M: pointer >c-array
    drop void* >c-array ;

GENERIC: <c-array> ( len c-type -- array )

M: word <c-array>
    c-array-constructor execute( len -- array ) ; inline

M: pointer <c-array>
    drop void* <c-array> ;

GENERIC: (c-array) ( len c-type -- array )

M: word (c-array)
{'fraction_non_alphanumeric': 0.14460700918679822, 'fraction_numerical': 0.008166042871725076, 'mean_word_length': 3.0163934426229506, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 30, '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': '2201007', 'n_tokens_mistral': 1076, 'n_tokens_neox': 1033, 'n_words': 307}