<commit_before>! Copyright (c) 2007 <NAME>
! Copyright (c) 2008 <NAME>
!
! Adapted from cairo.h, version 1.5.14
! License: http://factorcode.org/license.txt

USING: system combinators alien alien.syntax alien.c-types
alien.destructors kernel accessors sequences arrays ui.gadgets
alien.libraries classes.struct ;

IN: cairo.ffi
<< {
    { [ os winnt? ] [ "cairo" "libcairo-2.dll" "cdecl" add-library ] }
    { [ os macosx? ] [ "cairo" "/opt/local/lib/libcairo.dylib" "cdecl" add-library ] }
    { [ os unix? ] [ ] }
} cond >>

LIBRARY: cairo

FUNCTION: int cairo_version ( ) ;
FUNCTION: char* cairo_version_string ( ) ;

TYPEDEF: int cairo_bool_t

! I am leaving these and other void* types as opaque structures
TYPEDEF: void* cairo_t
TYPEDEF: void* cairo_surface_t

STRUCT: cairo_matrix_t
    { xx double }
    { yx double }
    { xy double }
    { yy double }
    { x0 double }
    { y0 double } ;

TYPEDEF: void* cairo_pattern_t

TYPEDEF: void* cairo_destroy_func_t
: cairo-destroy-func ( quot -- callback )
    [ void { void* } "cdecl" ] dip alien-callback ; inline

! See cairo.h for details
STRUCT: cairo_user_data_key_t
    { unused int } ;

TYPEDEF: int cairo_status_t
C-ENUM:
    CAIRO_STATUS_SUCCESS
    CAIRO_STATUS_NO_MEMORY
    CAIRO_STATUS_INVALID_RESTORE
    CAIRO_STATUS_INVALID_POP_GROUP
    CAIRO_STATUS_NO_CURRENT_POINT
    CAIRO_STATUS_INVALID_MATRIX
    CAIRO_STATUS_INVALID_STATUS
    CAIRO_STATUS_NULL_POINTER
    CAIRO_STATUS_INVALID_STRING
    CAIRO_STATUS_INVALID_PATH_DATA
    CAIRO_STATUS_READ_ERROR
    CAIRO_STATUS_WRITE_ERROR
    CAIRO_STATUS_SURFACE_FINISHED
    CAIRO_STATUS_SURFACE_TYPE_MISMATCH
    CAIRO_STATUS_PATTERN_TYPE_MISMATCH
    CAIRO_STATUS_INVALID_CONTENT
    CAIRO_STATUS_INVALID_FORMAT
    CAIRO_STATUS_INVALID_VISUAL
    CAIRO_STATUS_FILE_NOT_FOUND
    CAIRO_STATUS_INVALID_DASH
    CAIRO_STATUS_INVALID_DSC_COMMENT
    CAIRO_STATUS_INVALID_INDEX
    CAIRO_STATUS_CLIP_NOT_REPRESENTABLE
    CAIRO_STATUS_TEMP_FILE_ERROR
    CAIRO_STATUS_INVALID_STRIDE ;

TYPEDEF: int cairo_content_t
CONSTANT: CAIRO_CONTENT_COLOR HEX: 1000
CONSTANT: CAIRO_CONTENT_ALPHA HEX: 2000
CONSTANT: CAIRO_CONTENT_COLOR_ALPHA HEX: 3000

TYPEDEF: void* cairo_write_func_t
: cairo-write-func ( quot -- callback )
    [ cairo_status_t { void* uchar* int } "cdecl" ] dip alien-callback ; inline
                          
TYPEDEF: void* cairo_read_func_t
: cairo-read-func ( quot -- callback )
    [ cairo_status_t { void* uchar* int } "cdecl" ] dip alien-callback ; inline

! Functions for manipulating state objects
FUNCTION: cairo_t*
cairo_create ( cairo_surface_t* target ) ;

FUNCTION: cairo_t*
cairo_reference ( cairo_t* cr ) ;

FUNCTION: void
cairo_destroy ( cairo_t* cr ) ;

DESTRUCTOR: cairo_destroy

FUNCTION: uint
cairo_get_reference_count ( cairo_t* cr ) ;

FUNCTION: void*
cairo_get_user_data ( cairo_t* cr, cairo_user_data_key_t* key ) ;

FUNCTION: cairo_status_t
cairo_set_user_data ( cairo_t* cr, cairo_user_data_key_t* key, void* user_data, cairo_destroy_func_t destroy ) ;

FUNCTION: void
cairo_save ( cairo_t* cr ) ;

FUNCTION: void
cairo_restore ( cairo_t* cr ) ;
<commit_msg>cairo.ffi: update references to pointer types in alien-callbacks<commit_after>! Copyright (c) 2007 <NAME>
! Copyright (c) 2008 <NAME>
!
! Adapted from cairo.h, version 1.5.14
! License: http://factorcode.org/license.txt

USING: system combinators alien alien.syntax alien.c-types
alien.destructors kernel accessors sequences arrays ui.gadgets
alien.libraries classes.struct ;

IN: cairo.ffi
<< {
    { [ os winnt? ] [ "cairo" "libcairo-2.dll" "cdecl" add-library ] }
    { [ os macosx? ] [ "cairo" "/opt/local/lib/libcairo.dylib" "cdecl" add-library ] }
    { [ os unix? ] [ ] }
} cond >>

LIBRARY: cairo

FUNCTION: int cairo_version ( ) ;
FUNCTION: char* cairo_version_string ( ) ;

TYPEDEF: int cairo_bool_t

! I am leaving these and other void* types as opaque structures
TYPEDEF: void* cairo_t
TYPEDEF: void* cairo_surface_t

STRUCT: cairo_matrix_t
    { xx double }
    { yx double }
    { xy double }
    { yy double }
    { x0 double }
    { y0 double } ;

TYPEDEF: void* cairo_pattern_t

TYPEDEF: void* cairo_destroy_func_t
: cairo-destroy-func ( quot -- callback )
    [ void { pointer: void } "cdecl" ] dip alien-callback ; inline

! See cairo.h for details
STRUCT: cairo_user_data_key_t
    { unused int } ;

TYPEDEF: int cairo_status_t
C-ENUM:
    CAIRO_STATUS_SUCCESS
    CAIRO_STATUS_NO_MEMORY
    CAIRO_STATUS_INVALID_RESTORE
    CAIRO_STATUS_INVALID_POP_GROUP
    CAIRO_STATUS_NO_CURRENT_POINT
    CAIRO_STATUS_INVALID_MATRIX
    CAIRO_STATUS_INVALID_STATUS
    CAIRO_STATUS_NULL_POINTER
    CAIRO_STATUS_INVALID_STRING
    CAIRO_STATUS_INVALID_PATH_DATA
    CAIRO_STATUS_READ_ERROR
    CAIRO_STATUS_WRITE_ERROR
    CAIRO_STATUS_SURFACE_FINISHED
    CAIRO_STATUS_SURFACE_TYPE_MISMATCH
    CAIRO_STATUS_PATTERN_TYPE_MISMATCH
    CAIRO_STATUS_INVALID_CONTENT
    CAIRO_STATUS_INVALID_FORMAT
    CAIRO_STATUS_INVALID_VISUAL
    CAIRO_STATUS_FILE_NOT_FOUND
    CAIRO_STATUS_INVALID_DASH
    CAIRO_STATUS_INVALID_DSC_COMMENT
    CAIRO_STATUS_INVALID_INDEX
    CAIRO_STATUS_CLIP_NOT_REPRESENTABLE
    CAIRO_STATUS_TEMP_FILE_ERROR
    CAIRO_STATUS_INVALID_STRIDE ;

TYPEDEF: int cairo_content_t
CONSTANT: CAIRO_CONTENT_COLOR HEX: 1000
CONSTANT: CAIRO_CONTENT_ALPHA HEX: 2000
CONSTANT: CAIRO_CONTENT_COLOR_ALPHA HEX: 3000

TYPEDEF: void* cairo_write_func_t
: cairo-write-func ( quot -- callback )
    [ cairo_status_t { pointer: void pointer: uchar int } "cdecl" ] dip alien-callback ; inline
                          
TYPEDEF: void* cairo_read_func_t
: cairo-read-func ( quot -- callback )
    [ cairo_status_t { pointer: void pointer: uchar int } "cdecl" ] dip alien-callback ; inline

! Functions for manipulating state objects
FUNCTION: cairo_t*
cairo_create ( cairo_surface_t* target ) ;

FUNCTION: cairo_t*
cairo_reference ( cairo_t* cr ) ;

FUNCTION: void
cairo_destroy ( cairo_t* cr ) ;

DESTRUCTOR: cairo_destroy

FUNCTION: uint
cairo_get_reference_count ( cairo_t* cr ) ;

FUNCTION: void*
cairo_get_user_data ( cairo_t* cr, cairo_user_data_key_t* key ) ;

FUNCTION: cairo_status_t
cairo_set_user_data ( cairo_t* cr, cairo_user_data_key_t* key, void* user_data, cairo_destroy_func_t destroy ) ;

FUNCTION: void
cairo_save ( cairo_t* cr ) ;

FUNCTION: void
cairo_restore ( cairo_t* cr ) ;

{'fraction_non_alphanumeric': 0.07767758266097137, 'fraction_numerical': 0.00854295206454675, 'mean_word_length': 4.3260320134793595, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '4594692', 'n_tokens_mistral': 2457, 'n_tokens_neox': 2420, 'n_words': 490}