Changeset 2043 for libcaca/trunk


Ignore:
Timestamp:
Nov 24, 2007, 12:08:21 PM (13 years ago)
Author:
Sam Hocevar
Message:
  • Added as many "const" qualifiers as possible to the public API.
Location:
libcaca/trunk
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/caca.h

    r2039 r2043  
    193193__extern int caca_refresh_display(caca_display_t *);
    194194__extern int caca_set_display_time(caca_display_t *, unsigned int);
    195 __extern unsigned int caca_get_display_time(caca_display_t *);
    196 __extern unsigned int caca_get_display_width(caca_display_t *);
    197 __extern unsigned int caca_get_display_height(caca_display_t *);
     195__extern unsigned int caca_get_display_time(caca_display_t const *);
     196__extern unsigned int caca_get_display_width(caca_display_t const *);
     197__extern unsigned int caca_get_display_height(caca_display_t const *);
    198198__extern int caca_set_display_title(caca_display_t *, char const *);
    199199/*  @} */
     
    207207__extern int caca_get_event(caca_display_t *, unsigned int,
    208208                            caca_event_t *, int);
    209 __extern unsigned int caca_get_mouse_x(caca_display_t *);
    210 __extern unsigned int caca_get_mouse_y(caca_display_t *);
     209__extern unsigned int caca_get_mouse_x(caca_display_t const *);
     210__extern unsigned int caca_get_mouse_y(caca_display_t const *);
    211211__extern int caca_set_mouse(caca_display_t *, int);
    212212__extern int caca_set_cursor(caca_display_t *, int);
  • libcaca/trunk/caca/caca_internals.h

    r1462 r2043  
    109109        int (* end_graphics) (caca_display_t *);
    110110        int (* set_display_title) (caca_display_t *, char const *);
    111         unsigned int (* get_display_width) (caca_display_t *);
    112         unsigned int (* get_display_height) (caca_display_t *);
     111        unsigned int (* get_display_width) (caca_display_t const *);
     112        unsigned int (* get_display_height) (caca_display_t const *);
    113113        void (* display) (caca_display_t *);
    114114        void (* handle_resize) (caca_display_t *);
  • libcaca/trunk/caca/driver_conio.c

    r2040 r2043  
    8484}
    8585
    86 static unsigned int conio_get_display_width(caca_display_t *dp)
     86static unsigned int conio_get_display_width(caca_display_t const *dp)
    8787{
    8888    /* Fallback to a 6x10 font */
     
    9090}
    9191
    92 static unsigned int conio_get_display_height(caca_display_t *dp)
     92static unsigned int conio_get_display_height(caca_display_t const *dp)
    9393{
    9494    /* Fallback to a 6x10 font */
  • libcaca/trunk/caca/driver_gl.c

    r2040 r2043  
    198198}
    199199
    200 static unsigned int gl_get_display_width(caca_display_t *dp)
     200static unsigned int gl_get_display_width(caca_display_t const *dp)
    201201{
    202202    return dp->drv.p->width;
    203203}
    204204
    205 static unsigned int gl_get_display_height(caca_display_t *dp)
     205static unsigned int gl_get_display_height(caca_display_t const *dp)
    206206{
    207207    return dp->drv.p->height;
  • libcaca/trunk/caca/driver_ncurses.c

    r2040 r2043  
    327327}
    328328
    329 static unsigned int ncurses_get_display_width(caca_display_t *dp)
     329static unsigned int ncurses_get_display_width(caca_display_t const *dp)
    330330{
    331331    /* Fallback to a 6x10 font */
     
    333333}
    334334
    335 static unsigned int ncurses_get_display_height(caca_display_t *dp)
     335static unsigned int ncurses_get_display_height(caca_display_t const *dp)
    336336{
    337337    /* Fallback to a 6x10 font */
  • libcaca/trunk/caca/driver_raw.c

    r2040 r2043  
    5656}
    5757
    58 static unsigned int raw_get_display_width(caca_display_t *dp)
     58static unsigned int raw_get_display_width(caca_display_t const *dp)
    5959{
    6060    return 0;
    6161}
    6262
    63 static unsigned int raw_get_display_height(caca_display_t *dp)
     63static unsigned int raw_get_display_height(caca_display_t const *dp)
    6464{
    6565    return 0;
  • libcaca/trunk/caca/driver_slang.c

    r2040 r2043  
    194194}
    195195
    196 static unsigned int slang_get_display_width(caca_display_t *dp)
     196static unsigned int slang_get_display_width(caca_display_t const *dp)
    197197{
    198198    /* Fallback to a 6x10 font */
     
    200200}
    201201
    202 static unsigned int slang_get_display_height(caca_display_t *dp)
     202static unsigned int slang_get_display_height(caca_display_t const *dp)
    203203{
    204204    /* Fallback to a 6x10 font */
  • libcaca/trunk/caca/driver_vga.c

    r2040 r2043  
    102102}
    103103
    104 static unsigned int vga_get_display_width(caca_display_t *dp)
     104static unsigned int vga_get_display_width(caca_display_t const *dp)
    105105{
    106106    /* Fallback to a 320x200 screen */
     
    108108}
    109109
    110 static unsigned int vga_get_display_height(caca_display_t *dp)
     110static unsigned int vga_get_display_height(caca_display_t const *dp)
    111111{
    112112    /* Fallback to a 320x200 screen */
  • libcaca/trunk/caca/driver_win32.c

    r2040 r2043  
    172172}
    173173
    174 static unsigned int win32_get_display_width(caca_display_t *dp)
     174static unsigned int win32_get_display_width(caca_display_t const *dp)
    175175{
    176176    /* FIXME */
     
    180180}
    181181
    182 static unsigned int win32_get_display_height(caca_display_t *dp)
     182static unsigned int win32_get_display_height(caca_display_t const *dp)
    183183{
    184184    /* FIXME */
  • libcaca/trunk/caca/driver_x11.c

    r2040 r2043  
    275275}
    276276
    277 static unsigned int x11_get_display_width(caca_display_t *dp)
     277static unsigned int x11_get_display_width(caca_display_t const *dp)
    278278{
    279279    return dp->cv->width * dp->drv.p->font_width;
    280280}
    281281
    282 static unsigned int x11_get_display_height(caca_display_t *dp)
     282static unsigned int x11_get_display_height(caca_display_t const *dp)
    283283{
    284284    return dp->cv->height * dp->drv.p->font_height;
  • libcaca/trunk/caca/event.c

    r1556 r2043  
    126126 *  \return The X mouse coordinate.
    127127 */
    128 unsigned int caca_get_mouse_x(caca_display_t *dp)
     128unsigned int caca_get_mouse_x(caca_display_t const *dp)
    129129{
    130130    if(dp->mouse.x >= dp->cv->width)
    131         dp->mouse.x = dp->cv->width - 1;
     131        return dp->cv->width - 1;
    132132
    133133    return dp->mouse.x;
     
    146146 *  \return The Y mouse coordinate.
    147147 */
    148 unsigned int caca_get_mouse_y(caca_display_t *dp)
     148unsigned int caca_get_mouse_y(caca_display_t const *dp)
    149149{
    150150    if(dp->mouse.y >= dp->cv->height)
    151         dp->mouse.y = dp->cv->height - 1;
     151        return dp->cv->height - 1;
    152152
    153153    return dp->mouse.y;
  • libcaca/trunk/caca/graphics.c

    r2040 r2043  
    6565 *  \return The display width.
    6666 */
    67 unsigned int caca_get_display_width(caca_display_t *dp)
     67unsigned int caca_get_display_width(caca_display_t const *dp)
    6868{
    6969    return dp->drv.get_display_width(dp);
     
    8282 *  \return The display height.
    8383 */
    84 unsigned int caca_get_display_height(caca_display_t *dp)
     84unsigned int caca_get_display_height(caca_display_t const *dp)
    8585{
    8686    return dp->drv.get_display_height(dp);
     
    121121 *  \return The render time in microseconds.
    122122 */
    123 unsigned int caca_get_display_time(caca_display_t *dp)
     123unsigned int caca_get_display_time(caca_display_t const *dp)
    124124{
    125125    return dp->rendertime;
  • libcaca/trunk/cucul/attr.c

    r1462 r2043  
    5151 *  \return The requested attribute.
    5252 */
    53 unsigned long int cucul_get_attr(cucul_canvas_t *cv, int x, int y)
     53unsigned long int cucul_get_attr(cucul_canvas_t const *cv, int x, int y)
    5454{
    5555    if(x < 0 || x >= (int)cv->width || y < 0 || y >= (int)cv->height)
  • libcaca/trunk/cucul/canvas.c

    r1462 r2043  
    7070 *  \return The cursor's X coordinate.
    7171 */
    72 int cucul_get_cursor_x(cucul_canvas_t *cv)
     72int cucul_get_cursor_x(cucul_canvas_t const *cv)
    7373{
    7474    return cv->frames[cv->frame].x;
     
    8484 *  \return The cursor's Y coordinate.
    8585 */
    86 int cucul_get_cursor_y(cucul_canvas_t *cv)
     86int cucul_get_cursor_y(cucul_canvas_t const *cv)
    8787{
    8888    return cv->frames[cv->frame].y;
     
    193193 *  \return This function always returns 0.
    194194 */
    195 unsigned long int cucul_get_char(cucul_canvas_t *cv, int x, int y)
     195unsigned long int cucul_get_char(cucul_canvas_t const *cv, int x, int y)
    196196{
    197197    if(x < 0 || x >= (int)cv->width || y < 0 || y >= (int)cv->height)
     
    341341 *  \return The canvas' handle's X coordinate.
    342342 */
    343 int cucul_get_canvas_handle_x(cucul_canvas_t *cv)
     343int cucul_get_canvas_handle_x(cucul_canvas_t const *cv)
    344344{
    345345    return cv->frames[cv->frame].handlex;
     
    355355 *  \return The canvas' handle's Y coordinate.
    356356 */
    357 int cucul_get_canvas_handle_y(cucul_canvas_t *cv)
     357int cucul_get_canvas_handle_y(cucul_canvas_t const *cv)
    358358{
    359359    return cv->frames[cv->frame].handley;
  • libcaca/trunk/cucul/cucul.c

    r2040 r2043  
    150150 *  \return The canvas width.
    151151 */
    152 unsigned int cucul_get_canvas_width(cucul_canvas_t *cv)
     152unsigned int cucul_get_canvas_width(cucul_canvas_t const *cv)
    153153{
    154154    return cv->width;
     
    164164 *  \return The canvas height.
    165165 */
    166 unsigned int cucul_get_canvas_height(cucul_canvas_t *cv)
     166unsigned int cucul_get_canvas_height(cucul_canvas_t const *cv)
    167167{
    168168    return cv->height;
  • libcaca/trunk/cucul/cucul.h

    r2039 r2043  
    8787__extern int cucul_set_canvas_size(cucul_canvas_t *, unsigned int,
    8888                                   unsigned int);
    89 __extern unsigned int cucul_get_canvas_width(cucul_canvas_t *);
    90 __extern unsigned int cucul_get_canvas_height(cucul_canvas_t *);
     89__extern unsigned int cucul_get_canvas_width(cucul_canvas_t const *);
     90__extern unsigned int cucul_get_canvas_height(cucul_canvas_t const *);
    9191__extern int cucul_free_canvas(cucul_canvas_t *);
    9292__extern int cucul_rand(int, int);
     
    101101#define CUCUL_MAGIC_FULLWIDTH 0x000ffffe /**< Used to indicate that the previous character was a fullwidth glyph. */
    102102__extern int cucul_gotoxy(cucul_canvas_t *, int, int);
    103 __extern int cucul_get_cursor_x(cucul_canvas_t *);
    104 __extern int cucul_get_cursor_y(cucul_canvas_t *);
     103__extern int cucul_get_cursor_x(cucul_canvas_t const *);
     104__extern int cucul_get_cursor_y(cucul_canvas_t const *);
    105105__extern int cucul_put_char(cucul_canvas_t *, int, int, unsigned long int);
    106 __extern unsigned long int cucul_get_char(cucul_canvas_t *, int, int);
     106__extern unsigned long int cucul_get_char(cucul_canvas_t const *, int, int);
    107107__extern int cucul_put_str(cucul_canvas_t *, int, int, char const *);
    108 __extern unsigned long int cucul_get_attr(cucul_canvas_t *, int, int);
     108__extern unsigned long int cucul_get_attr(cucul_canvas_t const *, int, int);
    109109__extern int cucul_set_attr(cucul_canvas_t *, unsigned long int);
    110110__extern int cucul_put_attr(cucul_canvas_t *, int, int, unsigned long int);
     
    116116__extern int cucul_clear_canvas(cucul_canvas_t *);
    117117__extern int cucul_set_canvas_handle(cucul_canvas_t *, int, int);
    118 __extern int cucul_get_canvas_handle_x(cucul_canvas_t *);
    119 __extern int cucul_get_canvas_handle_y(cucul_canvas_t *);
     118__extern int cucul_get_canvas_handle_x(cucul_canvas_t const *);
     119__extern int cucul_get_canvas_handle_y(cucul_canvas_t const *);
    120120__extern int cucul_blit(cucul_canvas_t *, int, int, cucul_canvas_t const *,
    121121                        cucul_canvas_t const *);
     
    205205 *
    206206 *  @{ */
    207 __extern unsigned int cucul_get_frame_count(cucul_canvas_t *);
     207__extern unsigned int cucul_get_frame_count(cucul_canvas_t const *);
    208208__extern int cucul_set_frame(cucul_canvas_t *, unsigned int);
    209 __extern char const *cucul_get_frame_name(cucul_canvas_t *);
     209__extern char const *cucul_get_frame_name(cucul_canvas_t const *);
    210210__extern int cucul_set_frame_name(cucul_canvas_t *, char const *);
    211211__extern int cucul_create_frame(cucul_canvas_t *, unsigned int);
     
    229229                                      unsigned int b[], unsigned int a[]);
    230230__extern int cucul_set_dither_brightness(cucul_dither_t *, float);
    231 __extern float cucul_get_dither_brightness(cucul_dither_t *);
     231__extern float cucul_get_dither_brightness(cucul_dither_t const *);
    232232__extern int cucul_set_dither_gamma(cucul_dither_t *, float);
    233 __extern float cucul_get_dither_gamma(cucul_dither_t *);
     233__extern float cucul_get_dither_gamma(cucul_dither_t const *);
    234234__extern int cucul_set_dither_contrast(cucul_dither_t *, float);
    235 __extern float cucul_get_dither_contrast(cucul_dither_t *);
     235__extern float cucul_get_dither_contrast(cucul_dither_t const *);
    236236__extern int cucul_set_dither_antialias(cucul_dither_t *, char const *);
    237237__extern char const * const * cucul_get_dither_antialias_list(cucul_dither_t
     
    263263__extern cucul_font_t *cucul_load_font(void const *, unsigned int);
    264264__extern char const * const * cucul_get_font_list(void);
    265 __extern unsigned int cucul_get_font_width(cucul_font_t *);
    266 __extern unsigned int cucul_get_font_height(cucul_font_t *);
    267 __extern unsigned long int const *cucul_get_font_blocks(cucul_font_t *);
    268 __extern int cucul_render_canvas(cucul_canvas_t *, cucul_font_t *, void *,
    269                                  unsigned int, unsigned int, unsigned int);
     265__extern unsigned int cucul_get_font_width(cucul_font_t const *);
     266__extern unsigned int cucul_get_font_height(cucul_font_t const *);
     267__extern unsigned long int const *cucul_get_font_blocks(cucul_font_t const *);
     268__extern int cucul_render_canvas(cucul_canvas_t const *, cucul_font_t const *,
     269                                 void *, unsigned int, unsigned int,
     270                                 unsigned int);
    270271__extern int cucul_free_font(cucul_font_t *);
    271272/*  @} */
     
    283284                                    char const *);
    284285__extern char const * const * cucul_get_import_list(void);
    285 __extern void *cucul_export_memory(cucul_canvas_t *, char const *,
     286__extern void *cucul_export_memory(cucul_canvas_t const *, char const *,
    286287                                   unsigned long int *);
    287288__extern char const * const * cucul_get_export_list(void);
  • libcaca/trunk/cucul/dither.c

    r1881 r2043  
    442442 *  \return Brightness value.
    443443 */
    444 float cucul_get_dither_brightness(cucul_dither_t *d)
     444float cucul_get_dither_brightness(cucul_dither_t const *d)
    445445{
    446446    return d->brightness;
     
    494494 *  \return Gamma value.
    495495 */
    496 float cucul_get_dither_gamma(cucul_dither_t *d)
     496float cucul_get_dither_gamma(cucul_dither_t const *d)
    497497{
    498498    return d->gamma;
     
    527527 *  \return Contrast value.
    528528 */
    529 float cucul_get_dither_contrast(cucul_dither_t *d)
     529float cucul_get_dither_contrast(cucul_dither_t const *d)
    530530{
    531531    return d->contrast;
  • libcaca/trunk/cucul/export.c

    r1462 r2043  
    4646}
    4747
    48 static void *export_caca(cucul_canvas_t *, unsigned long int *);
    49 static void *export_ansi(cucul_canvas_t *, unsigned long int *);
    50 static void *export_utf8(cucul_canvas_t *, unsigned long int *, int);
    51 static void *export_html(cucul_canvas_t *, unsigned long int *);
    52 static void *export_html3(cucul_canvas_t *, unsigned long int *);
    53 static void *export_irc(cucul_canvas_t *, unsigned long int *);
    54 static void *export_ps(cucul_canvas_t *, unsigned long int *);
    55 static void *export_svg(cucul_canvas_t *, unsigned long int *);
    56 static void *export_tga(cucul_canvas_t *, unsigned long int *);
     48static void *export_caca(cucul_canvas_t const *, unsigned long int *);
     49static void *export_ansi(cucul_canvas_t const *, unsigned long int *);
     50static void *export_utf8(cucul_canvas_t const *, unsigned long int *, int);
     51static void *export_html(cucul_canvas_t const *, unsigned long int *);
     52static void *export_html3(cucul_canvas_t const *, unsigned long int *);
     53static void *export_irc(cucul_canvas_t const *, unsigned long int *);
     54static void *export_ps(cucul_canvas_t const *, unsigned long int *);
     55static void *export_svg(cucul_canvas_t const *, unsigned long int *);
     56static void *export_tga(cucul_canvas_t const *, unsigned long int *);
    5757
    5858/** \brief Export a canvas into a foreign format.
     
    8383 *  \return A pointer to the exported memory area, or NULL in case of error.
    8484 */
    85 void *cucul_export_memory(cucul_canvas_t *cv, char const *format,
     85void *cucul_export_memory(cucul_canvas_t const *cv, char const *format,
    8686                          unsigned long int *bytes)
    8787{
     
    156156
    157157/* Generate a native libcaca canvas file. */
    158 static void *export_caca(cucul_canvas_t *cv, unsigned long int *bytes)
     158static void *export_caca(cucul_canvas_t const *cv, unsigned long int *bytes)
    159159{
    160160    uint32_t *attrs = cv->attrs;
     
    202202
    203203/* Generate UTF-8 representation of current canvas. */
    204 static void *export_utf8(cucul_canvas_t *cv, unsigned long int *bytes, int cr)
     204static void *export_utf8(cucul_canvas_t const *cv, unsigned long int *bytes,
     205                         int cr)
    205206{
    206207    static uint8_t const palette[] =
     
    282283
    283284/* Generate ANSI representation of current canvas. */
    284 static void *export_ansi(cucul_canvas_t *cv, unsigned long int *bytes)
     285static void *export_ansi(cucul_canvas_t const *cv, unsigned long int *bytes)
    285286{
    286287    static uint8_t const palette[] =
     
    362363
    363364/* Generate HTML representation of current canvas. */
    364 static void *export_html(cucul_canvas_t *cv, unsigned long int *bytes)
     365static void *export_html(cucul_canvas_t const *cv, unsigned long int *bytes)
    365366{
    366367    char *data, *cur;
     
    444445 * will not work under gecko (mozilla rendering engine) unless you set a
    445446 * correct header. */
    446 static void *export_html3(cucul_canvas_t *cv, unsigned long int *bytes)
     447static void *export_html3(cucul_canvas_t const *cv, unsigned long int *bytes)
    447448{
    448449    char *data, *cur;
     
    546547
    547548/* Export a text file with IRC colours */
    548 static void *export_irc(cucul_canvas_t *cv, unsigned long int *bytes)
     549static void *export_irc(cucul_canvas_t const *cv, unsigned long int *bytes)
    549550{
    550551    static uint8_t const palette[] =
     
    653654
    654655/* Export a PostScript document. */
    655 static void *export_ps(cucul_canvas_t *cv, unsigned long int *bytes)
     656static void *export_ps(cucul_canvas_t const *cv, unsigned long int *bytes)
    656657{
    657658    static char const *ps_header =
     
    762763
    763764/* Export an SVG vector image */
    764 static void *export_svg(cucul_canvas_t *cv, unsigned long int *bytes)
     765static void *export_svg(cucul_canvas_t const *cv, unsigned long int *bytes)
    765766{
    766767    static char const svg_header[] =
     
    848849
    849850/* Export a TGA image */
    850 static void *export_tga(cucul_canvas_t *cv, unsigned long int *bytes)
     851static void *export_tga(cucul_canvas_t const *cv, unsigned long int *bytes)
    851852{
    852853    char const * const *fontlist;
  • libcaca/trunk/cucul/font.c

    r1878 r2043  
    326326 *  \return The standard glyph width.
    327327 */
    328 unsigned int cucul_get_font_width(cucul_font_t *f)
     328unsigned int cucul_get_font_width(cucul_font_t const *f)
    329329{
    330330    return f->header.width;
     
    341341 *  \return The standard glyph height.
    342342 */
    343 unsigned int cucul_get_font_height(cucul_font_t *f)
     343unsigned int cucul_get_font_height(cucul_font_t const *f)
    344344{
    345345    return f->header.height;
     
    366366 *  \return The list of Unicode blocks supported by the font.
    367367 */
    368 unsigned long int const *cucul_get_font_blocks(cucul_font_t *f)
     368unsigned long int const *cucul_get_font_blocks(cucul_font_t const *f)
    369369{
    370370    return (unsigned long int const *)f->user_block_list;
     
    416416 *  \return This function always returns 0.
    417417 */
    418 int cucul_render_canvas(cucul_canvas_t *cv, cucul_font_t *f,
     418int cucul_render_canvas(cucul_canvas_t const *cv, cucul_font_t const *f,
    419419                        void *buf, unsigned int width,
    420420                        unsigned int height, unsigned int pitch)
  • libcaca/trunk/cucul/frame.c

    r1462 r2043  
    3838 *  \return The frame count
    3939 */
    40 unsigned int cucul_get_frame_count(cucul_canvas_t *cv)
     40unsigned int cucul_get_frame_count(cucul_canvas_t const *cv)
    4141{
    4242    return cv->framecount;
     
    8484 *  \return The current frame's name.
    8585 */
    86 char const *cucul_get_frame_name(cucul_canvas_t *cv)
     86char const *cucul_get_frame_name(cucul_canvas_t const *cv)
    8787{
    8888    return cv->frames[cv->frame].name;
Note: See TracChangeset for help on using the changeset viewer.