<commit_before>/*
 *  text          canvas text import/export
 *  Copyright (c) 2006 <NAME> <<EMAIL>>
 *                All Rights Reserved
 *
 *  $Id$
 *
 *  This program is free software. It comes without any warranty, to
 *  the extent permitted by applicable law. You can redistribute it
 *  and/or modify it under the terms of the Do What The Fuck You Want
 *  To Public License, Version 2, as published by Sam Hocevar. See
 *  http://sam.zoy.org/wtfpl/COPYING for more details.
 */

#include "config.h"
#include "common.h"
#if !defined(__KERNEL__)
#   if defined(HAVE_INTTYPES_H)
#      include <inttypes.h>
#   endif
#   include <stdio.h>
#   include <string.h>
#   include <stdlib.h>
#endif
#include "cucul.h"

#define STRING \
  "  _,----._  \n" \
  " (/ @  @ \\) \n" \
  "  |  OO  |  \n" \
  "  \\ `--' /  \n" \
  "   `----'   \n" \
  "Hello world!\n"

int main(int argc, char *argv[])
{
    cucul_canvas_t *cv, *pig;
    void *buffer;
    unsigned long int len;

    pig = cucul_create_canvas(0, 0);
    cucul_import_memory(pig, STRING, strlen(STRING), "text");

    cv = cucul_create_canvas(cucul_get_canvas_width(pig) * 2,
                             cucul_get_canvas_height(pig) * 2);

    if(cv == NULL || pig == NULL)
    {
        printf("Can't created canvas\n");
        return -1;
    }

    cucul_blit(cv, 0, 0, pig, NULL);
    cucul_flip(pig);
    cucul_blit(cv, cucul_get_canvas_width(pig), 0, pig, NULL);
    cucul_flip(pig);
    cucul_flop(pig);
    cucul_blit(cv, 0, cucul_get_canvas_height(pig), pig, NULL);
    cucul_flop(pig);
    cucul_rotate(pig);
    cucul_blit(cv, cucul_get_canvas_width(pig),
                   cucul_get_canvas_height(pig), pig, NULL);

    buffer = cucul_export_memory(cv, "utf8", &len);
    fwrite(buffer, len, 1, stdout);
    free(buffer);

    cucul_free_canvas(pig);
    cucul_free_canvas(cv);

    return 0;
}
<commit_msg>  * Added a small test for cucul_left() in test/text.c. It is *fucking* ugly.<commit_after>/*
 *  text          canvas text import/export
 *  Copyright (c) 2006 <NAME> <<EMAIL>>
 *                All Rights Reserved
 *
 *  $Id$
 *
 *  This program is free software. It comes without any warranty, to
 *  the extent permitted by applicable law. You can redistribute it
 *  and/or modify it under the terms of the Do What The Fuck You Want
 *  To Public License, Version 2, as published by Sam Hocevar. See
 *  http://sam.zoy.org/wtfpl/COPYING for more details.
 */

#include "config.h"
#include "common.h"
#if !defined(__KERNEL__)
#   if defined(HAVE_INTTYPES_H)
#      include <inttypes.h>
#   endif
#   include <stdio.h>
#   include <string.h>
#   include <stdlib.h>
#endif
#include "cucul.h"

#define STRING \
  "              \n" \
  "   _,----._   \n" \
  "  (/ @  @ \\)  \n" \
  "   |  OO  |   \n" \
  "   \\ `--' /   \n" \
  "    `----'    \n" \
  "              \n" \
  " Hello world! \n" \
  "              \n"

int main(int argc, char *argv[])
{
    cucul_canvas_t *cv, *pig;
    void *buffer;
    unsigned long int len;

    pig = cucul_create_canvas(0, 0);
    cucul_import_memory(pig, STRING, strlen(STRING), "text");

    cv = cucul_create_canvas(cucul_get_canvas_width(pig) * 2,
                             cucul_get_canvas_height(pig) * 2);

    if(cv == NULL || pig == NULL)
    {
        printf("Can't created canvas\n");
        return -1;
    }

    cucul_blit(cv, 0, 0, pig, NULL);
    cucul_flip(pig);
    cucul_blit(cv, cucul_get_canvas_width(pig), 0, pig, NULL);
    cucul_flip(pig);
    cucul_flop(pig);
    cucul_blit(cv, 0, cucul_get_canvas_height(pig), pig, NULL);
    cucul_flop(pig);
    cucul_rotate(pig);
    cucul_blit(cv, cucul_get_canvas_width(pig),
                   cucul_get_canvas_height(pig), pig, NULL);

    buffer = cucul_export_memory(cv, "utf8", &len);
    fwrite(buffer, len, 1, stdout);
    free(buffer);

    cucul_left(cv);
    buffer = cucul_export_memory(cv, "utf8", &len);
    fwrite(buffer, len, 1, stdout);
    free(buffer);

    cucul_free_canvas(pig);
    cucul_free_canvas(cv);

    return 0;
}

{'fraction_non_alphanumeric': 0.14476945959345563, 'fraction_numerical': 0.008924144769459593, 'mean_word_length': 2.4516680923866554, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '1617108', 'n_tokens_mistral': 1639, 'n_tokens_neox': 1558, 'n_words': 360}