<commit_before>/*
 *  truecolor     truecolor canvas features
 *  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"

#if !defined(__KERNEL__)
#   include <stdio.h>
#endif

#include "caca.h"

int main(int argc, char *argv[])
{
    caca_canvas_t *cv;
    caca_display_t *dp;

    int x, y;

    cv = caca_create_canvas(32, 16);
    if(cv == NULL)
    {
        printf("Failed to create canvas\n");
        return 1;
    }

    dp = caca_create_display(cv);
    if(dp == NULL)
    {
        printf("Failed to create display\n");
        return 1;
    }

    for(y = 0; y < 16; y++)
        for(x = 0; x < 16; x++)
    {
        uint16_t bgcolor = 0xff00 | (y << 4) | x;
        uint16_t fgcolor = 0xf000 | ((15 - y) << 4) | ((15 - x) << 8);

        caca_set_color_argb(cv, fgcolor, bgcolor);
        caca_put_str(cv, x * 2, y, "CA");
    }

    caca_set_color_ansi(cv, CACA_WHITE, CACA_LIGHTBLUE);
    caca_put_str(cv, 2, 1, " truecolor libcaca ");

    caca_refresh_display(dp);

    caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);

    caca_free_display(dp);
    caca_free_canvas(cv);

    return 0;
}
<commit_msg>convert to PHP and make executable<commit_after>#!/usr/bin/php5
<?php
/*
 *  truecolor	  truecolor canvas features
 *  Copyright (c) 2008 <NAME> <<EMAIL>>
 *
 *  This file is a Php port of "examples/truecolor.c"
 *  which is: 
 *  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.
 */

$cv = caca_create_canvas(32, 16);
if(!$cv) {
	die("Failed to create canvas\n");
}

$dp = caca_create_display($cv);
if(!$dp) {
	die("Failed to create display\n");
}

for($y = 0; $y < 16; $y++)
	for($x = 0; $x < 16; $x++)
	{
		$bgcolor = 0xff00 | ($y << 4) | $x;
		$fgcolor = 0xf000 | ((15 - $y) << 4) | ((15 - $x) << 8);
		
		caca_set_color_argb($cv, $fgcolor, $bgcolor);
		caca_put_str($cv, $x * 2, $y, "CA");
	}

caca_set_color_ansi($cv, CACA_WHITE, CACA_LIGHTBLUE);
caca_put_str($cv, 2, 1, " truecolor libcaca ");

caca_refresh_display($dp);

caca_get_event($dp, CACA_EVENT_KEY_PRESS, -1);

?>
{'fraction_non_alphanumeric': 0.1470160116448326, 'fraction_numerical': 0.028384279475982533, 'mean_word_length': 2.9440459110473456, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 14, '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': '7367523', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1041, 'n_words': 299}