caca.c (libcaca-0.99.beta19) | : | caca.c (libcaca-0.99.beta20.tar.bz2) | ||
---|---|---|---|---|
/* | /* | |||
* libcaca Colour ASCII-Art library | * libcaca Colour ASCII-Art library | |||
* Copyright (c) 2006-2012 Sam Hocevar <sam@hocevar.net> | * Copyright © 2006—2021 Sam Hocevar <sam@hocevar.net> | |||
* All Rights Reserved | * All Rights Reserved | |||
* | * | |||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | |||
* the extent permitted by applicable law. You can redistribute it | * 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 | * 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 | * to Public License, Version 2, as published by Sam Hocevar. See | |||
* http://www.wtfpl.net/ for more details. | * http://www.wtfpl.net/ for more details. | |||
*/ | */ | |||
/* | /* | |||
* This file contains the main functions used by \e libcaca applications to | * This file contains the main functions used by \e libcaca applications to | |||
skipping to change at line 59 | skipping to change at line 59 | |||
* | * | |||
* Create a graphical context using device-dependent features (ncurses for | * Create a graphical context using device-dependent features (ncurses for | |||
* terminals, an X11 window, a DOS command window...) that attaches to a | * terminals, an X11 window, a DOS command window...) that attaches to a | |||
* libcaca canvas. Everything that gets drawn in the libcaca canvas can | * libcaca canvas. Everything that gets drawn in the libcaca canvas can | |||
* then be displayed by the libcaca driver. | * then be displayed by the libcaca driver. | |||
* | * | |||
* If no caca canvas is provided, a new one is created. Its handle can be | * If no caca canvas is provided, a new one is created. Its handle can be | |||
* retrieved using caca_get_canvas() and it is automatically destroyed when | * retrieved using caca_get_canvas() and it is automatically destroyed when | |||
* caca_free_display() is called. | * caca_free_display() is called. | |||
* | * | |||
* Note that in order to achieve maximum Unicode compatibility, the driver | ||||
* initialisation code may temporarily change the program’s global LC_CTYPE | ||||
* locale using setlocale(). It is advised not to call LC_CTYPE-dependent | ||||
* functions from other threads during the call to caca_create_display(). | ||||
* The locale settings are restored when the function returns. | ||||
* | ||||
* See also caca_create_display_with_driver(). | * See also caca_create_display_with_driver(). | |||
* | * | |||
* If an error occurs, NULL is returned and \b errno is set accordingly: | * If an error occurs, NULL is returned and \b errno is set accordingly: | |||
* - \c ENOMEM Not enough memory. | * - \c ENOMEM Not enough memory. | |||
* - \c ENODEV Graphical device could not be initialised. | * - \c ENODEV Graphical device could not be initialised. | |||
* | * | |||
* \param cv The caca canvas or NULL to create a canvas automatically. | * \param cv The caca canvas or NULL to create a canvas automatically. | |||
* \return The caca graphical context or NULL if an error occurred. | * \return The caca graphical context or NULL if an error occurred. | |||
*/ | */ | |||
caca_display_t * caca_create_display(caca_canvas_t *cv) | caca_display_t * caca_create_display(caca_canvas_t *cv) | |||
skipping to change at line 278 | skipping to change at line 284 | |||
* This function never fails. | * This function never fails. | |||
* | * | |||
* \return The \e libcaca version information. | * \return The \e libcaca version information. | |||
*/ | */ | |||
char const * caca_get_version(void) | char const * caca_get_version(void) | |||
{ | { | |||
return PACKAGE_VERSION; | return PACKAGE_VERSION; | |||
} | } | |||
/* | /* | |||
* XXX: The following functions are private. | ||||
*/ | ||||
extern void *_caca_alloc2d(size_t width, size_t height, size_t elem_size) | ||||
{ | ||||
if (width == 0 || height == 0 || elem_size == 0 || SIZE_MAX / width / height | ||||
< elem_size) | ||||
return NULL; | ||||
return malloc(width * height * elem_size); | ||||
} | ||||
/* | ||||
* XXX: The following functions are local. | * XXX: The following functions are local. | |||
*/ | */ | |||
static int caca_can_resize(caca_display_t *dp) | static int caca_can_resize(caca_display_t *dp) | |||
{ | { | |||
return dp->resize.allow; | return dp->resize.allow; | |||
} | } | |||
static int caca_install_driver(caca_display_t *dp, char const *driver) | static int caca_install_driver(caca_display_t *dp, char const *driver) | |||
{ | { | |||
skipping to change at line 469 | skipping to change at line 486 | |||
sym = dlsym(dp->plugin, buf); | sym = dlsym(dp->plugin, buf); | |||
if(!sym) | if(!sym) | |||
{ | { | |||
dlclose(dp->plugin); | dlclose(dp->plugin); | |||
return -1; | return -1; | |||
} | } | |||
return sym(dp); | return sym(dp); | |||
} | } | |||
#endif | #endif | |||
/* | ||||
* XXX: The following functions are aliases. | ||||
*/ | ||||
char const * cucul_get_version(void) CACA_ALIAS(caca_get_version); | ||||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 21 lines changed or added |