Browse Source

* Changed most of the long ints in the API into C99 types. WARNING: this

completely breaks compatibility with previous versions of libcaca on
    64-bit systems.
tags/v0.99.beta14
Sam Hocevar sam 16 years ago
parent
commit
6a3f5c21f0
17 changed files with 123 additions and 156 deletions
  1. +2
    -2
      caca/caca.h
  2. +1
    -1
      caca/driver_gl.c
  3. +1
    -1
      caca/event.c
  4. +18
    -39
      cucul/attr.c
  5. +2
    -2
      cucul/box.c
  6. +3
    -3
      cucul/canvas.c
  7. +6
    -6
      cucul/charset.c
  8. +3
    -4
      cucul/conic.c
  9. +31
    -40
      cucul/cucul.h
  10. +4
    -6
      cucul/dither.c
  11. +3
    -3
      cucul/figfont.c
  12. +4
    -4
      cucul/font.c
  13. +2
    -2
      cucul/line.c
  14. +2
    -2
      cucul/triangle.c
  15. +20
    -20
      cxx/cucul++.cpp
  16. +20
    -20
      cxx/cucul++.h
  17. +1
    -1
      ruby/cucul-font.c

+ 2
- 2
caca/caca.h View File

@@ -81,7 +81,7 @@ struct caca_event
{
struct { unsigned int x, y, button; } mouse;
struct { unsigned int w, h; } resize;
struct { unsigned int ch; unsigned long int utf32; char utf8[8]; } key;
struct { unsigned int ch; uint32_t utf32; char utf8[8]; } key;
} data;
uint8_t padding[16];
};
@@ -192,7 +192,7 @@ __extern unsigned int caca_get_mouse_x(caca_display_t const *);
__extern unsigned int caca_get_mouse_y(caca_display_t const *);
__extern enum caca_event_type caca_get_event_type(caca_event_t const *);
__extern unsigned int caca_get_event_key_ch(caca_event_t const *);
__extern unsigned long int caca_get_event_key_utf32(caca_event_t const *);
__extern uint32_t caca_get_event_key_utf32(caca_event_t const *);
__extern int caca_get_event_key_utf8(caca_event_t const *, char *);
__extern unsigned int caca_get_event_mouse_button(caca_event_t const *);
__extern unsigned int caca_get_event_mouse_x(caca_event_t const *);


+ 1
- 1
caca/driver_gl.c View File

@@ -68,7 +68,7 @@ struct driver_private
cucul_font_t *f;
float font_width, font_height;
float incx, incy;
unsigned long int const *blocks;
uint32_t const *blocks;
int *txid;
uint8_t close;
uint8_t bit;


+ 1
- 1
caca/event.c View File

@@ -215,7 +215,7 @@ unsigned int caca_get_event_key_ch(caca_event_t const *ev)
* \param ev The libcaca event.
* \return The key's Unicode value.
*/
unsigned long int caca_get_event_key_utf32(caca_event_t const *ev)
uint32_t caca_get_event_key_utf32(caca_event_t const *ev)
{
return ((caca_privevent_t const *)ev)->data.key.utf32;
}


+ 18
- 39
cucul/attr.c View File

@@ -65,12 +65,12 @@ static const uint16_t ansitab14[16] =
* \param y Y coordinate.
* \return The requested attribute.
*/
unsigned long int cucul_get_attr(cucul_canvas_t const *cv, int x, int y)
uint32_t cucul_get_attr(cucul_canvas_t const *cv, int x, int y)
{
if(x < 0 || x >= (int)cv->width || y < 0 || y >= (int)cv->height)
return (unsigned long int)cv->curattr;
return cv->curattr;

return (unsigned long int)cv->attrs[x + y * cv->width];
return cv->attrs[x + y * cv->width];
}

/** \brief Set the default character attribute.
@@ -90,21 +90,14 @@ unsigned long int cucul_get_attr(cucul_canvas_t const *cv, int x, int y)
*
* To retrieve the current attribute value, use cucul_get_attr(-1,-1).
*
* If an error occurs, -1 is returned and \b errno is set accordingly:
* - \c EINVAL The attribute value is out of the 32-bit range.
* This function never fails.
*
* \param cv A handle to the libcucul canvas.
* \param attr The requested attribute value.
* \return 0 in case of success, -1 if an error occurred.
* \return This function always returns 0.
*/
int cucul_set_attr(cucul_canvas_t *cv, unsigned long int attr)
int cucul_set_attr(cucul_canvas_t *cv, uint32_t attr)
{
if(sizeof(unsigned long int) > sizeof(uint32_t) && attr > 0xffffffff)
{
seterrno(EINVAL);
return -1;
}

if(attr < 0x00000010)
attr = (cv->curattr & 0xfffffff0) | attr;

@@ -126,25 +119,18 @@ int cucul_set_attr(cucul_canvas_t *cv, unsigned long int attr)
* \e CUCUL_BLINK, \e CUCUL_BOLD and \e CUCUL_ITALICS), in which case
* setting the attribute does not modify the current colour information.
*
* If an error occurs, -1 is returned and \b errno is set accordingly:
* - \c EINVAL The attribute value is out of the 32-bit range.
* This function never fails.
*
* \param cv A handle to the libcucul canvas.
* \param x X coordinate.
* \param y Y coordinate.
* \param attr The requested attribute value.
* \return 0 in case of success, -1 if an error occurred.
* \return This function always returns 0.
*/
int cucul_put_attr(cucul_canvas_t *cv, int x, int y, unsigned long int attr)
int cucul_put_attr(cucul_canvas_t *cv, int x, int y, uint32_t attr)
{
uint32_t *curattr, *curchar;

if(sizeof(unsigned long int) > sizeof(uint32_t) && attr > 0xffffffff)
{
seterrno(EINVAL);
return -1;
}

if(x < 0 || x >= (int)cv->width || y < 0 || y >= (int)cv->height)
return 0;

@@ -207,24 +193,17 @@ int cucul_set_color_ansi(cucul_canvas_t *cv, uint8_t fg, uint8_t bg)
* instance, 0xf088 is solid dark cyan (A=15 R=0 G=8 B=8), and 0x8fff is
* white with 50% alpha (A=8 R=15 G=15 B=15).
*
* If an error occurs, 0 is returned and \b errno is set accordingly:
* - \c EINVAL At least one of the colour values is invalid.
* This function never fails.
*
* \param cv A handle to the libcucul canvas.
* \param fg The requested ARGB foreground colour.
* \param bg The requested ARGB background colour.
* \return 0 in case of success, -1 if an error occurred.
* \return This function always returns 0.
*/
int cucul_set_color_argb(cucul_canvas_t *cv, unsigned int fg, unsigned int bg)
int cucul_set_color_argb(cucul_canvas_t *cv, uint16_t fg, uint16_t bg)
{
uint32_t attr;

if(fg > 0xffff || bg > 0xffff)
{
seterrno(EINVAL);
return -1;
}

if(fg < 0x100)
fg += 0x100;

@@ -257,7 +236,7 @@ int cucul_set_color_argb(cucul_canvas_t *cv, unsigned int fg, unsigned int bg)
* \param attr The requested attribute value.
* \return The corresponding DOS ANSI value.
*/
uint8_t cucul_attr_to_ansi(unsigned long int attr)
uint8_t cucul_attr_to_ansi(uint32_t attr)
{
uint8_t fg = nearest_ansi((attr >> 4) & 0x3fff);
uint8_t bg = nearest_ansi(attr >> 18);
@@ -281,7 +260,7 @@ uint8_t cucul_attr_to_ansi(unsigned long int attr)
* \param attr The requested attribute value.
* \return The corresponding ANSI foreground value.
*/
uint8_t cucul_attr_to_ansi_fg(unsigned long int attr)
uint8_t cucul_attr_to_ansi_fg(uint32_t attr)
{
return nearest_ansi(((uint16_t)attr >> 4) & 0x3fff);
}
@@ -301,7 +280,7 @@ uint8_t cucul_attr_to_ansi_fg(unsigned long int attr)
* \param attr The requested attribute value.
* \return The corresponding ANSI background value.
*/
uint8_t cucul_attr_to_ansi_bg(unsigned long int attr)
uint8_t cucul_attr_to_ansi_bg(uint32_t attr)
{
return nearest_ansi(attr >> 18);
}
@@ -321,7 +300,7 @@ uint8_t cucul_attr_to_ansi_bg(unsigned long int attr)
* \param attr The requested attribute value.
* \return The corresponding 12-bit RGB foreground value.
*/
unsigned int cucul_attr_to_rgb12_fg(unsigned long int attr)
uint16_t cucul_attr_to_rgb12_fg(uint32_t attr)
{
uint16_t fg = (attr >> 4) & 0x3fff;

@@ -352,7 +331,7 @@ unsigned int cucul_attr_to_rgb12_fg(unsigned long int attr)
* \param attr The requested attribute value.
* \return The corresponding 12-bit RGB background value.
*/
unsigned int cucul_attr_to_rgb12_bg(unsigned long int attr)
uint16_t cucul_attr_to_rgb12_bg(uint32_t attr)
{
uint16_t bg = attr >> 18;

@@ -387,7 +366,7 @@ unsigned int cucul_attr_to_rgb12_bg(unsigned long int attr)
* \param attr The requested attribute value.
* \param argb An array of 8-bit integers.
*/
void cucul_attr_to_argb64(unsigned long int attr, uint8_t argb[8])
void cucul_attr_to_argb64(uint32_t attr, uint8_t argb[8])
{
uint16_t fg = (attr >> 4) & 0x3fff;
uint16_t bg = attr >> 18;


+ 2
- 2
cucul/box.c View File

@@ -38,7 +38,7 @@
* \return This function always returns 0.
*/
int cucul_draw_box(cucul_canvas_t *cv, int x1, int y1, int w, int h,
unsigned long int ch)
uint32_t ch)
{
int x2 = x1 + w - 1;
int y2 = y1 + h - 1;
@@ -188,7 +188,7 @@ int cucul_draw_cp437_box(cucul_canvas_t *cv, int x1, int y1, int w, int h)
* \return This function always returns 0.
*/
int cucul_fill_box(cucul_canvas_t *cv, int x1, int y1, int w, int h,
unsigned long int ch)
uint32_t ch)
{
int x, y, xmax, ymax;



+ 3
- 3
cucul/canvas.c View File

@@ -109,7 +109,7 @@ int cucul_get_cursor_y(cucul_canvas_t const *cv)
* \param ch The character to print.
* \return This function always returns 0.
*/
int cucul_put_char(cucul_canvas_t *cv, int x, int y, unsigned long int ch)
int cucul_put_char(cucul_canvas_t *cv, int x, int y, uint32_t ch)
{
uint32_t *curchar, *curattr, attr;
int fullwidth;
@@ -191,12 +191,12 @@ int cucul_put_char(cucul_canvas_t *cv, int x, int y, unsigned long int ch)
* \param y Y coordinate.
* \return This function always returns 0.
*/
unsigned long int cucul_get_char(cucul_canvas_t const *cv, int x, int y)
uint32_t cucul_get_char(cucul_canvas_t const *cv, int x, int y)
{
if(x < 0 || x >= (int)cv->width || y < 0 || y >= (int)cv->height)
return ' ';

return (unsigned long int)cv->chars[x + y * cv->width];
return cv->chars[x + y * cv->width];
}

/** \brief Print a string.


+ 6
- 6
cucul/charset.c View File

@@ -111,7 +111,7 @@ static uint32_t const cp437_lookup2[] =
* \return The corresponding UTF-32 character, or zero if the character
* is incomplete.
*/
unsigned long int cucul_utf8_to_utf32(char const *s, unsigned int *read)
uint32_t cucul_utf8_to_utf32(char const *s, unsigned int *read)
{
unsigned int bytes = trailing[(int)(unsigned char)*s];
unsigned int i = 0;
@@ -150,7 +150,7 @@ unsigned long int cucul_utf8_to_utf32(char const *s, unsigned int *read)
* \param ch The UTF-32 character.
* \return The number of bytes written.
*/
unsigned int cucul_utf32_to_utf8(char *buf, unsigned long int ch)
unsigned int cucul_utf32_to_utf8(char *buf, uint32_t ch)
{
static const uint8_t mark[7] =
{
@@ -190,7 +190,7 @@ unsigned int cucul_utf32_to_utf8(char *buf, unsigned long int ch)
* \param ch The UTF-32 character.
* \return The corresponding CP437 character, or "?" if not representable.
*/
uint8_t cucul_utf32_to_cp437(unsigned long int ch)
uint8_t cucul_utf32_to_cp437(uint32_t ch)
{
unsigned int i;

@@ -222,7 +222,7 @@ uint8_t cucul_utf32_to_cp437(unsigned long int ch)
* \param ch The CP437 character.
* \return The corresponding UTF-32 character, or zero if not representable.
*/
unsigned long int cucul_cp437_to_utf32(uint8_t ch)
uint32_t cucul_cp437_to_utf32(uint8_t ch)
{
if(ch > 0x7f)
return cp437_lookup2[ch - 0x7f];
@@ -248,7 +248,7 @@ unsigned long int cucul_cp437_to_utf32(uint8_t ch)
* \return The corresponding ASCII character, or a graphically close
* equivalent if found, or "?" if not representable.
*/
char cucul_utf32_to_ascii(unsigned long int ch)
char cucul_utf32_to_ascii(uint32_t ch)
{
/* Standard ASCII */
if(ch < 0x80)
@@ -387,7 +387,7 @@ char cucul_utf32_to_ascii(unsigned long int ch)
* \param ch The UTF-32 character.
* \return 1 if the character is fullwidth, 0 otherwise.
*/
int cucul_utf32_is_fullwidth(unsigned long int ch)
int cucul_utf32_is_fullwidth(uint32_t ch)
{
if(ch < 0x2e80) /* Standard stuff */
return 0;


+ 3
- 4
cucul/conic.c View File

@@ -39,8 +39,7 @@ static void ellipsepoints(cucul_canvas_t *, int, int, int, int, uint32_t, int);
* \param ch UTF-32 character to be used to draw the circle outline.
* \return This function always returns 0.
*/
int cucul_draw_circle(cucul_canvas_t *cv, int x, int y, int r,
unsigned long int ch)
int cucul_draw_circle(cucul_canvas_t *cv, int x, int y, int r, uint32_t ch)
{
int test, dx, dy;

@@ -69,7 +68,7 @@ int cucul_draw_circle(cucul_canvas_t *cv, int x, int y, int r,
* \return This function always returns 0.
*/
int cucul_fill_ellipse(cucul_canvas_t *cv, int xo, int yo, int a, int b,
unsigned long int ch)
uint32_t ch)
{
int d2;
int x = 0;
@@ -129,7 +128,7 @@ int cucul_fill_ellipse(cucul_canvas_t *cv, int xo, int yo, int a, int b,
* \return This function always returns 0.
*/
int cucul_draw_ellipse(cucul_canvas_t *cv, int xo, int yo, int a, int b,
unsigned long int ch)
uint32_t ch)
{
int d2;
int x = 0;


+ 31
- 40
cucul/cucul.h View File

@@ -110,15 +110,14 @@ __extern char const * cucul_get_version(void);
__extern int cucul_gotoxy(cucul_canvas_t *, int, int);
__extern int cucul_get_cursor_x(cucul_canvas_t const *);
__extern int cucul_get_cursor_y(cucul_canvas_t const *);
__extern int cucul_put_char(cucul_canvas_t *, int, int, unsigned long int);
__extern unsigned long int cucul_get_char(cucul_canvas_t const *, int, int);
__extern int cucul_put_char(cucul_canvas_t *, int, int, uint32_t);
__extern uint32_t cucul_get_char(cucul_canvas_t const *, int, int);
__extern int cucul_put_str(cucul_canvas_t *, int, int, char const *);
__extern unsigned long int cucul_get_attr(cucul_canvas_t const *, int, int);
__extern int cucul_set_attr(cucul_canvas_t *, unsigned long int);
__extern int cucul_put_attr(cucul_canvas_t *, int, int, unsigned long int);
__extern uint32_t cucul_get_attr(cucul_canvas_t const *, int, int);
__extern int cucul_set_attr(cucul_canvas_t *, uint32_t);
__extern int cucul_put_attr(cucul_canvas_t *, int, int, uint32_t);
__extern int cucul_set_color_ansi(cucul_canvas_t *, uint8_t, uint8_t);
__extern int cucul_set_color_argb(cucul_canvas_t *, unsigned int,
unsigned int);
__extern int cucul_set_color_argb(cucul_canvas_t *, uint16_t, uint16_t);
__extern int cucul_printf(cucul_canvas_t *, int, int, char const *, ...);
__extern int cucul_clear_canvas(cucul_canvas_t *);
__extern int cucul_set_canvas_handle(cucul_canvas_t *, int, int);
@@ -150,12 +149,12 @@ __extern int cucul_stretch_right(cucul_canvas_t *);
* These functions perform conversions between attribute values.
*
* @{ */
__extern uint8_t cucul_attr_to_ansi(unsigned long int);
__extern uint8_t cucul_attr_to_ansi_fg(unsigned long int);
__extern uint8_t cucul_attr_to_ansi_bg(unsigned long int);
__extern unsigned int cucul_attr_to_rgb12_fg(unsigned long int);
__extern unsigned int cucul_attr_to_rgb12_bg(unsigned long int);
__extern void cucul_attr_to_argb64(unsigned long int, uint8_t[8]);
__extern uint8_t cucul_attr_to_ansi(uint32_t);
__extern uint8_t cucul_attr_to_ansi_fg(uint32_t);
__extern uint8_t cucul_attr_to_ansi_bg(uint32_t);
__extern uint16_t cucul_attr_to_rgb12_fg(uint32_t);
__extern uint16_t cucul_attr_to_rgb12_bg(uint32_t);
__extern void cucul_attr_to_argb64(uint32_t, uint8_t[8]);
/* @} */

/** \defgroup cucul_charset libcucul character set conversions
@@ -163,12 +162,12 @@ __extern void cucul_attr_to_argb64(unsigned long int, uint8_t[8]);
* These functions perform conversions between usual character sets.
*
* @{ */
__extern unsigned long int cucul_utf8_to_utf32(char const *, unsigned int *);
__extern unsigned int cucul_utf32_to_utf8(char *, unsigned long int);
__extern uint8_t cucul_utf32_to_cp437(unsigned long int);
__extern unsigned long int cucul_cp437_to_utf32(uint8_t);
__extern char cucul_utf32_to_ascii(unsigned long int);
__extern int cucul_utf32_is_fullwidth(unsigned long int);
__extern uint32_t cucul_utf8_to_utf32(char const *, unsigned int *);
__extern unsigned int cucul_utf32_to_utf8(char *, uint32_t);
__extern uint8_t cucul_utf32_to_cp437(uint32_t);
__extern uint32_t cucul_cp437_to_utf32(uint8_t);
__extern char cucul_utf32_to_ascii(uint32_t);
__extern int cucul_utf32_is_fullwidth(uint32_t);
/* @} */

/** \defgroup cucul_primitives libcucul primitives drawing
@@ -177,35 +176,29 @@ __extern int cucul_utf32_is_fullwidth(unsigned long int);
* boxes, triangles and ellipses.
*
* @{ */
__extern int cucul_draw_line(cucul_canvas_t *, int, int, int, int,
unsigned long int);
__extern int cucul_draw_line(cucul_canvas_t *, int, int, int, int, uint32_t);
__extern int cucul_draw_polyline(cucul_canvas_t *, int const x[],
int const y[], int, unsigned long int);
int const y[], int, uint32_t);
__extern int cucul_draw_thin_line(cucul_canvas_t *, int, int, int, int);
__extern int cucul_draw_thin_polyline(cucul_canvas_t *, int const x[],
int const y[], int);

__extern int cucul_draw_circle(cucul_canvas_t *, int, int, int,
unsigned long int);
__extern int cucul_draw_ellipse(cucul_canvas_t *, int, int, int, int,
unsigned long int);
__extern int cucul_draw_circle(cucul_canvas_t *, int, int, int, uint32_t);
__extern int cucul_draw_ellipse(cucul_canvas_t *, int, int, int, int, uint32_t);
__extern int cucul_draw_thin_ellipse(cucul_canvas_t *, int, int, int, int);
__extern int cucul_fill_ellipse(cucul_canvas_t *, int, int, int, int,
unsigned long int);
__extern int cucul_fill_ellipse(cucul_canvas_t *, int, int, int, int, uint32_t);

__extern int cucul_draw_box(cucul_canvas_t *, int, int, int, int,
unsigned long int);
__extern int cucul_draw_box(cucul_canvas_t *, int, int, int, int, uint32_t);
__extern int cucul_draw_thin_box(cucul_canvas_t *, int, int, int, int);
__extern int cucul_draw_cp437_box(cucul_canvas_t *, int, int, int, int);
__extern int cucul_fill_box(cucul_canvas_t *, int, int, int, int,
unsigned long int);
__extern int cucul_fill_box(cucul_canvas_t *, int, int, int, int, uint32_t);

__extern int cucul_draw_triangle(cucul_canvas_t *, int, int, int, int, int,
int, unsigned long int);
int, uint32_t);
__extern int cucul_draw_thin_triangle(cucul_canvas_t *, int, int, int, int,
int, int);
__extern int cucul_fill_triangle(cucul_canvas_t *, int, int, int, int, int,
int, unsigned long int);
int, uint32_t);
/* @} */

/** \defgroup cucul_frame libcucul canvas frame handling
@@ -230,10 +223,8 @@ __extern int cucul_free_frame(cucul_canvas_t *, unsigned int);
* @{ */
__extern cucul_dither_t *cucul_create_dither(unsigned int, unsigned int,
unsigned int, unsigned int,
unsigned long int,
unsigned long int,
unsigned long int,
unsigned long int);
uint32_t, uint32_t,
uint32_t, uint32_t);
__extern int cucul_set_dither_palette(cucul_dither_t *,
unsigned int r[], unsigned int g[],
unsigned int b[], unsigned int a[]);
@@ -274,7 +265,7 @@ __extern cucul_font_t *cucul_load_font(void const *, unsigned int);
__extern char const * const * cucul_get_font_list(void);
__extern unsigned int cucul_get_font_width(cucul_font_t const *);
__extern unsigned int cucul_get_font_height(cucul_font_t const *);
__extern unsigned long int const *cucul_get_font_blocks(cucul_font_t const *);
__extern unsigned int const *cucul_get_font_blocks(cucul_font_t const *);
__extern int cucul_render_canvas(cucul_canvas_t const *, cucul_font_t const *,
void *, unsigned int, unsigned int,
unsigned int);
@@ -287,7 +278,7 @@ __extern int cucul_free_font(cucul_font_t *);
*
* @{ */
__extern int cucul_canvas_set_figfont(cucul_canvas_t *, char const *);
__extern int cucul_put_figchar(cucul_canvas_t *, unsigned long int);
__extern int cucul_put_figchar(cucul_canvas_t *, uint32_t);
/* @} */

/** \defgroup cucul_importexport libcucul importers/exporters from/to various


+ 4
- 6
cucul/dither.c View File

@@ -169,7 +169,7 @@ struct cucul_dither
/*
* Local prototypes
*/
static void mask2shift(unsigned long int, int *, int *);
static void mask2shift(uint32_t, int *, int *);
static float gammapow(float x, float y);

static void get_rgba_default(cucul_dither_t const *, uint8_t *, int, int,
@@ -262,10 +262,8 @@ static inline void rgb2hsv_default(int r, int g, int b,
*/
cucul_dither_t *cucul_create_dither(unsigned int bpp, unsigned int w,
unsigned int h, unsigned int pitch,
unsigned long int rmask,
unsigned long int gmask,
unsigned long int bmask,
unsigned long int amask)
uint32_t rmask, uint32_t gmask,
uint32_t bmask, uint32_t amask)
{
cucul_dither_t *d;
int i;
@@ -1213,7 +1211,7 @@ int cucul_free_dither(cucul_dither_t *d)
*/

/* Convert a mask, eg. 0x0000ff00, to shift values, eg. 8 and -4. */
static void mask2shift(unsigned long int mask, int *right, int *left)
static void mask2shift(uint32_t mask, int *right, int *left)
{
int rshift = 0, lshift = 0;



+ 3
- 3
cucul/figfont.c View File

@@ -38,7 +38,7 @@ struct cucul_figfont

enum { H_DEFAULT, H_KERN, H_SMUSH, H_NONE, H_OVERLAP } hmode;
unsigned int hsmushrule;
unsigned long int hardblank;
uint32_t hardblank;
unsigned int height, baseline, max_length;
int old_layout;
unsigned int print_direction, full_layout, codetag_count;
@@ -127,7 +127,7 @@ int cucul_canvas_set_figfont(cucul_canvas_t *cv, char const *path)
return 0;
}

int cucul_put_figchar(cucul_canvas_t *cv, unsigned long int ch)
int cucul_put_figchar(cucul_canvas_t *cv, uint32_t ch)
{
cucul_figfont_t *ff = cv->ff;
unsigned int c, w, h, x, y, overlap, extra, xleft, xright;
@@ -450,7 +450,7 @@ cucul_figfont_t * open_figfont(char const *path)
* smushing, nor any kind of error checking. */
for(j = 0; j < ff->height * ff->glyphs; j++)
{
unsigned long int ch, oldch = 0;
uint32_t ch, oldch = 0;

for(i = ff->max_length; i--;)
{


+ 4
- 4
cucul/font.c View File

@@ -60,7 +60,7 @@ struct cucul_font
struct font_header header;

struct block_info *block_list;
unsigned long int *user_block_list;
uint32_t *user_block_list;
struct glyph_info *glyph_list;
uint8_t *font_data;

@@ -186,7 +186,7 @@ cucul_font_t *cucul_load_font(void const *data, unsigned int size)
}

f->user_block_list = malloc((f->header.blocks + 1)
* 2 * sizeof(unsigned long int));
* 2 * sizeof(uint32_t));
if(!f->user_block_list)
{
free(f->block_list);
@@ -364,9 +364,9 @@ unsigned int cucul_get_font_height(cucul_font_t const *f)
* \param f The font, as returned by cucul_load_font()
* \return The list of Unicode blocks supported by the font.
*/
unsigned long int const *cucul_get_font_blocks(cucul_font_t const *f)
uint32_t const *cucul_get_font_blocks(cucul_font_t const *f)
{
return (unsigned long int const *)f->user_block_list;
return (uint32_t const *)f->user_block_list;
}

/** \brief Free a font structure.


+ 2
- 2
cucul/line.c View File

@@ -54,7 +54,7 @@ static void draw_thin_line(cucul_canvas_t*, struct line*);
* \return This function always returns 0.
*/
int cucul_draw_line(cucul_canvas_t *cv, int x1, int y1, int x2, int y2,
unsigned long int ch)
uint32_t ch)
{
struct line s;
s.x1 = x1;
@@ -85,7 +85,7 @@ int cucul_draw_line(cucul_canvas_t *cv, int x1, int y1, int x2, int y2,
* \return This function always returns 0.
*/
int cucul_draw_polyline(cucul_canvas_t *cv, int const x[], int const y[],
int n, unsigned long int ch)
int n, uint32_t ch)
{
int i;
struct line s;


+ 2
- 2
cucul/triangle.c View File

@@ -40,7 +40,7 @@
* \return This function always returns 0.
*/
int cucul_draw_triangle(cucul_canvas_t *cv, int x1, int y1, int x2, int y2,
int x3, int y3, unsigned long int ch)
int x3, int y3, uint32_t ch)
{
cucul_draw_line(cv, x1, y1, x2, y2, ch);
cucul_draw_line(cv, x2, y2, x3, y3, ch);
@@ -87,7 +87,7 @@ int cucul_draw_thin_triangle(cucul_canvas_t *cv, int x1, int y1,
* \return This function always returns 0.
*/
int cucul_fill_triangle(cucul_canvas_t *cv, int x1, int y1, int x2, int y2,
int x3, int y3, unsigned long int ch)
int x3, int y3, uint32_t ch)
{
int x, y, xmin, xmax, ymin, ymax;
long int xx1, xx2, xa, xb, sl21, sl31, sl32;


+ 20
- 20
cxx/cucul++.cpp View File

@@ -25,19 +25,19 @@
#include "cucul++.h"


unsigned long int Charset::utf8ToUtf32(char const *s, unsigned int *read)
uint32_t Charset::utf8ToUtf32(char const *s, unsigned int *read)
{
return cucul_utf8_to_utf32(s, read);
}
unsigned int Charset::utf32ToUtf8(char *buf, unsigned long int ch)
unsigned int Charset::utf32ToUtf8(char *buf, uint32_t ch)
{
return cucul_utf32_to_utf8(buf, ch);
}
unsigned char Charset::utf32ToCp437(unsigned long int ch)
uint8_t Charset::utf32ToCp437(uint32_t ch)
{
return cucul_utf32_to_cp437(ch);
}
unsigned long int Charset::cp437ToUtf32(unsigned char ch)
uint32_t Charset::cp437ToUtf32(uint8_t ch)
{
return cucul_cp437_to_utf32(ch);
}
@@ -82,7 +82,7 @@ unsigned int Cucul::getHeight(void)
return cucul_get_canvas_height(cv);
}

int Cucul::setColorANSI(unsigned char f, unsigned char b)
int Cucul::setColorANSI(uint8_t f, uint8_t b)
{
return cucul_set_color_ansi(cv, f, b);
}
@@ -92,12 +92,12 @@ int Cucul::setColorARGB(unsigned int f, unsigned int b)
return cucul_set_color_argb(cv, f, b);
}

void Cucul::putChar(int x, int y, unsigned long int ch)
void Cucul::putChar(int x, int y, uint32_t ch)
{
cucul_put_char(cv, x, y, ch);
}

unsigned long int Cucul::getChar(int x, int y)
uint32_t Cucul::getChar(int x, int y)
{
return cucul_get_char(cv, x, y);
}
@@ -156,12 +156,12 @@ void Cucul::Rotate()
cucul_rotate_180(cv);
}

void Cucul::drawLine(int x1, int y1, int x2, int y2, unsigned long int ch)
void Cucul::drawLine(int x1, int y1, int x2, int y2, uint32_t ch)
{
cucul_draw_line(cv, x1, y1, x2, y2, ch);
}

void Cucul::drawPolyline(int const x[], int const y[], int f, unsigned long int ch)
void Cucul::drawPolyline(int const x[], int const y[], int f, uint32_t ch)
{
cucul_draw_polyline(cv, x, y, f, ch);
}
@@ -176,12 +176,12 @@ void Cucul::drawThinPolyline(int const x[], int const y[], int f)
cucul_draw_thin_polyline(cv, x, y, f);
}

void Cucul::drawCircle(int x, int y, int d, unsigned long int ch)
void Cucul::drawCircle(int x, int y, int d, uint32_t ch)
{
cucul_draw_circle(cv, x, y, d, ch);
}

void Cucul::drawEllipse(int x, int y, int d1, int d2, unsigned long int ch)
void Cucul::drawEllipse(int x, int y, int d1, int d2, uint32_t ch)
{
cucul_draw_ellipse(cv, x, y, d1, d2, ch);
}
@@ -191,12 +191,12 @@ void Cucul::drawThinEllipse(int x, int y, int d1, int d2)
cucul_draw_thin_ellipse(cv, x, y, d1, d2);
}

void Cucul::fillEllipse(int x, int y, int d1, int d2, unsigned long int ch)
void Cucul::fillEllipse(int x, int y, int d1, int d2, uint32_t ch)
{
cucul_fill_ellipse(cv, x, y, d1, d2, ch);
}

void Cucul::drawBox(int x, int y, int w, int h, unsigned long int ch)
void Cucul::drawBox(int x, int y, int w, int h, uint32_t ch)
{
cucul_draw_box(cv, x, y, w, h, ch);
}
@@ -211,12 +211,12 @@ void Cucul::drawCP437Box(int x, int y, int w, int h)
cucul_draw_cp437_box(cv, x, y, w, h);
}

void Cucul::fillBox(int x, int y, int w, int h, unsigned long int ch)
void Cucul::fillBox(int x, int y, int w, int h, uint32_t ch)
{
cucul_fill_box(cv, x, y, w, h, ch);
}

void Cucul::drawTriangle(int x1, int y1, int x2, int y2, int x3, int y3, unsigned long int ch)
void Cucul::drawTriangle(int x1, int y1, int x2, int y2, int x3, int y3, uint32_t ch)
{
cucul_draw_triangle(cv, x1, y1, x2, y2, x3, y3, ch);
}
@@ -226,7 +226,7 @@ void Cucul::drawThinTriangle(int x1, int y1, int x2, int y2, int x3, int y3)
cucul_draw_thin_triangle(cv, x1, y1, x2, y2, x3, y3);
}

void Cucul::fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3, unsigned long int ch)
void Cucul::fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3, uint32_t ch)
{
cucul_fill_triangle(cv, x1, y1, x2, y2, x3, y3, ch);
}
@@ -241,12 +241,12 @@ const char * Cucul::getVersion()
return cucul_get_version();
}

int Cucul::setAttr(unsigned long int attr)
int Cucul::setAttr(uint32_t attr)
{
return cucul_set_attr(cv, attr);
}

unsigned long int Cucul::getAttr(int x, int y)
uint32_t Cucul::getAttr(int x, int y)
{
return cucul_get_attr(cv, x, y);
}
@@ -394,12 +394,12 @@ unsigned int Font::getHeight()
return cucul_get_font_height(font);
}

void Font::renderCanvas(Cucul *cv, unsigned char *buf, unsigned int x, unsigned int y, unsigned int w)
void Font::renderCanvas(Cucul *cv, uint8_t *buf, unsigned int x, unsigned int y, unsigned int w)
{
cucul_render_canvas(cv->get_cucul_canvas_t(), font, buf, x, y, w);
}

unsigned long int const *Font::getBlocks()
uint32_t const *Font::getBlocks()
{
return cucul_get_font_blocks(font);
}


+ 20
- 20
cxx/cucul++.h View File

@@ -38,10 +38,10 @@ class Cucul;
__class Charset
{
public:
unsigned long int utf8ToUtf32(char const *, unsigned int *);
unsigned int utf32ToUtf8(char *, unsigned long int);
unsigned char utf32ToCp437(unsigned long int);
unsigned long int cp437ToUtf32(unsigned char);
uint32_t utf8ToUtf32(char const *, unsigned int *);
unsigned int utf32ToUtf8(char *, uint32_t);
uint8_t utf32ToCp437(uint32_t);
uint32_t cp437ToUtf32(uint8_t);
};

/* Ugly, I know */
@@ -53,9 +53,9 @@ __class Font
char const *const * getList(void);
unsigned int getWidth();
unsigned int getHeight();
void renderCanvas(Cucul *, unsigned char *, unsigned int,
void renderCanvas(Cucul *, uint8_t *, unsigned int,
unsigned int, unsigned int);
unsigned long int const *getBlocks();
uint32_t const *getBlocks();

private:
cucul_font *font;
@@ -100,13 +100,13 @@ __class Cucul
void setSize(unsigned int w, unsigned int h);
unsigned int getWidth(void);
unsigned int getHeight(void);
unsigned long int getAttr(int, int);
int setAttr(unsigned long int);
int setColorANSI(unsigned char f, unsigned char b);
uint32_t getAttr(int, int);
int setAttr(uint32_t);
int setColorANSI(uint8_t f, uint8_t b);
int setColorARGB(unsigned int f, unsigned int b);
void Printf(int x, int y , char const * format, ...);
void putChar(int x, int y, unsigned long int ch);
unsigned long int getChar(int, int);
void putChar(int x, int y, uint32_t ch);
uint32_t getChar(int, int);
void putStr(int x, int y, char *str);
void Clear(void);
void Blit(int, int, Cucul* c1, Cucul* c2);
@@ -114,21 +114,21 @@ __class Cucul
void Flip();
void Flop();
void Rotate();
void drawLine(int, int, int, int, unsigned long int);
void drawPolyline(int const x[], int const y[], int, unsigned long int);
void drawLine(int, int, int, int, uint32_t);
void drawPolyline(int const x[], int const y[], int, uint32_t);
void drawThinLine(int, int, int, int);
void drawThinPolyline(int const x[], int const y[], int);
void drawCircle(int, int, int, unsigned long int);
void drawEllipse(int, int, int, int, unsigned long int);
void drawCircle(int, int, int, uint32_t);
void drawEllipse(int, int, int, int, uint32_t);
void drawThinEllipse(int, int, int, int);
void fillEllipse(int, int, int, int, unsigned long int);
void drawBox(int, int, int, int, unsigned long int);
void fillEllipse(int, int, int, int, uint32_t);
void drawBox(int, int, int, int, uint32_t);
void drawThinBox(int, int, int, int);
void drawCP437Box(int, int, int, int);
void fillBox(int, int, int, int, unsigned long int);
void drawTriangle(int, int, int, int, int, int, unsigned long int);
void fillBox(int, int, int, int, uint32_t);
void drawTriangle(int, int, int, int, int, int, uint32_t);
void drawThinTriangle(int, int, int, int, int, int);
void fillTriangle(int, int, int, int, int, int, unsigned long int);
void fillTriangle(int, int, int, int, int, int, uint32_t);
int setBoundaries(cucul_canvas_t *, int, int, unsigned int, unsigned int);
unsigned int getFrameCount();
int setFrame(unsigned int);


+ 1
- 1
ruby/cucul-font.c View File

@@ -71,7 +71,7 @@ static VALUE get_font_height(VALUE self)
static VALUE get_font_blocks(VALUE self)
{
VALUE ary;
unsigned long int const *list;
uint32_t const *list;
list = cucul_get_font_blocks(_SELF);


Loading…
Cancel
Save