Changeset 3587 for libcaca/trunk


Ignore:
Timestamp:
Jul 27, 2009, 1:26:15 AM (10 years ago)
Author:
Sam Hocevar
Message:

Rename caca_get_cursor_x() and caca_get_cursor_y() to caca_wherex() and
caca_wherey(), in order to match the old <conio.h> naming scheme.

Location:
libcaca/trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca-php/caca.php

    r3295 r3587  
    121121        }
    122122
    123         function getCursorX() {
    124                 return caca_get_cursor_x($this->cv);
    125         }
    126 
    127         function getCursorY() {
    128                 return caca_get_cursor_y($this->cv);
     123        function whereX() {
     124                return caca_wherex($this->cv);
     125        }
     126
     127        function whereY() {
     128                return caca_wherey($this->cv);
    129129        }
    130130
  • libcaca/trunk/caca-php/php_caca.c

    r3582 r3587  
    3232    PHP_FE(caca_get_version, NULL)
    3333    PHP_FE(caca_gotoxy, NULL)
    34     PHP_FE(caca_get_cursor_x, NULL)
    35     PHP_FE(caca_get_cursor_y, NULL)
     34    PHP_FE(caca_wherex, NULL)
     35    PHP_FE(caca_wherey, NULL)
    3636    PHP_FE(caca_put_char, NULL)
    3737    PHP_FE(caca_get_char, NULL)
     
    493493}
    494494
    495 PHP_FUNCTION(caca_get_cursor_x) {
     495PHP_FUNCTION(caca_wherex) {
    496496    caca_canvas_t *canvas;
    497497    FETCH_CANVAS(canvas);
    498     RETURN_LONG(caca_get_cursor_x(canvas));
    499 }
    500 
    501 PHP_FUNCTION(caca_get_cursor_y) {
     498    RETURN_LONG(caca_wherex(canvas));
     499}
     500
     501PHP_FUNCTION(caca_wherey) {
    502502    caca_canvas_t *canvas;
    503503    FETCH_CANVAS(canvas);
    504     RETURN_LONG(caca_get_cursor_y(canvas));
     504    RETURN_LONG(caca_wherey(canvas));
    505505}
    506506
  • libcaca/trunk/caca-php/php_caca.h

    r3149 r3587  
    4545PHP_FUNCTION(caca_get_version);
    4646PHP_FUNCTION(caca_gotoxy);
    47 PHP_FUNCTION(caca_get_cursor_x);
    48 PHP_FUNCTION(caca_get_cursor_y);
     47PHP_FUNCTION(caca_wherex);
     48PHP_FUNCTION(caca_wherey);
    4949PHP_FUNCTION(caca_put_char);
    5050PHP_FUNCTION(caca_get_char);
  • libcaca/trunk/caca-sharp/Canvas.cs

    r2867 r3587  
    22 *  libcaca       .NET bindings for libcaca
    33 *  Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
    4  *                2007 Sam Hocevar <sam@zoy.org>
     4 *                2007-2009 Sam Hocevar <sam@hocevar.net>
    55 *                All Rights Reserved
    66 *
     
    116116        [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl),
    117117         SuppressUnmanagedCodeSecurity]
    118         private static extern int caca_get_cursor_x(IntPtr cv);
    119         [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl),
    120          SuppressUnmanagedCodeSecurity]
    121         private static extern int caca_get_cursor_y(IntPtr cv);
     118        private static extern int caca_wherex(IntPtr cv);
     119        [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl),
     120         SuppressUnmanagedCodeSecurity]
     121        private static extern int caca_wherey(IntPtr cv);
    122122        public Point Cursor
    123123        {
    124             get { return new Point(caca_get_cursor_x(_c_cv),
    125                                    caca_get_cursor_y(_c_cv)); }
     124            get { return new Point(caca_wherex(_c_cv), caca_wherey(_c_cv)); }
    126125            set { caca_gotoxy(_c_cv, value.X, value.Y); }
    127126        }
  • libcaca/trunk/caca/caca.h

    r3586 r3587  
    226226#define CACA_MAGIC_FULLWIDTH 0x000ffffe /**< Used to indicate that the previous character was a fullwidth glyph. */
    227227__extern int caca_gotoxy(caca_canvas_t *, int, int);
    228 __extern int caca_get_cursor_x(caca_canvas_t const *);
    229 __extern int caca_get_cursor_y(caca_canvas_t const *);
     228__extern int caca_wherex(caca_canvas_t const *);
     229__extern int caca_wherey(caca_canvas_t const *);
    230230__extern int caca_put_char(caca_canvas_t *, int, int, uint32_t);
    231231__extern uint32_t caca_get_char(caca_canvas_t const *, int, int);
     
    507507
    508508
    509 /* Aliases from old libcucul functions */
     509/* Aliases from old libcaca and libcucul functions */
    510510__extern int cucul_putchar(caca_canvas_t *, int, int,
    511511                           unsigned long int) CACA_DEPRECATED;
     
    601601
    602602#   if !defined __LIBCACA__
     603#       define caca_get_cursor_x caca_wherex
     604#       define caca_get_cursor_y caca_wherey
    603605#       define cucul_draw_triangle caca_draw_triangle
    604606#       define cucul_draw_thin_triangle caca_draw_thin_triangle
     
    612614#       define cucul_free_font caca_free_font
    613615#       define cucul_gotoxy caca_gotoxy
    614 #       define cucul_get_cursor_x caca_get_cursor_x
    615 #       define cucul_get_cursor_y caca_get_cursor_y
     616#       define cucul_get_cursor_x caca_wherex
     617#       define cucul_get_cursor_y caca_wherey
    616618#       define cucul_put_char caca_put_char
    617619#       define cucul_get_char caca_get_char
  • libcaca/trunk/caca/driver/ncurses.c

    r3578 r3587  
    376376    }
    377377
    378     x = caca_get_cursor_x(dp->cv);
    379     y = caca_get_cursor_y(dp->cv);
     378    x = caca_wherex(dp->cv);
     379    y = caca_wherey(dp->cv);
    380380    move(y, x);
    381381
  • libcaca/trunk/caca/driver/slang.c

    r3569 r3587  
    288288        }
    289289    }
    290     SLsmg_gotorc(caca_get_cursor_y(dp->cv), caca_get_cursor_x(dp->cv));
     290    SLsmg_gotorc(caca_wherey(dp->cv), caca_wherex(dp->cv));
    291291    SLsmg_refresh();
    292292}
  • libcaca/trunk/caca/driver/x11.c

    r3581 r3587  
    377377        XSetForeground(dp->drv.p->dpy, dp->drv.p->gc,
    378378                       dp->drv.p->colors[0xfff]);
    379         x = caca_get_cursor_x(dp->cv);
    380         y = caca_get_cursor_y(dp->cv);
     379        x = caca_wherex(dp->cv);
     380        y = caca_wherey(dp->cv);
    381381        XFillRectangle(dp->drv.p->dpy, dp->drv.p->pixmap, dp->drv.p->gc,
    382382                       x * dp->drv.p->font_width, y * dp->drv.p->font_height,
  • libcaca/trunk/caca/string.c

    r3586 r3587  
    6969 *  \return The cursor's X coordinate.
    7070 */
    71 int caca_get_cursor_x(caca_canvas_t const *cv)
     71int caca_wherex(caca_canvas_t const *cv)
    7272{
    7373    return cv->frames[cv->frame].x;
     
    8383 *  \return The cursor's Y coordinate.
    8484 */
    85 int caca_get_cursor_y(caca_canvas_t const *cv)
     85int caca_wherey(caca_canvas_t const *cv)
    8686{
    8787    return cv->frames[cv->frame].y;
     
    583583
    584584int cucul_gotoxy(cucul_canvas_t *, int, int) CACA_ALIAS(caca_gotoxy);
    585 int cucul_get_cursor_x(cucul_canvas_t const *) CACA_ALIAS(caca_get_cursor_x);
    586 int cucul_get_cursor_y(cucul_canvas_t const *) CACA_ALIAS(caca_get_cursor_y);
     585int cucul_get_cursor_x(cucul_canvas_t const *) CACA_ALIAS(caca_wherex);
     586int cucul_get_cursor_y(cucul_canvas_t const *) CACA_ALIAS(caca_wherey);
     587int caca_get_cursor_x(caca_canvas_t const *) CACA_ALIAS(caca_wherex);
     588int caca_get_cursor_y(caca_canvas_t const *) CACA_ALIAS(caca_wherey);
    587589int cucul_put_char(cucul_canvas_t *, int, int, uint32_t)
    588590         CACA_ALIAS(caca_put_char);
  • libcaca/trunk/ruby/caca-canvas.c

    r3582 r3587  
    110110}
    111111
    112 get_int(cursor_x)
    113 get_int(cursor_y)
     112static VALUE wherex(VALUE self)
     113{
     114    return INT2NUM(caca_wherex(_SELF));
     115}
     116
     117static VALUE wherey(VALUE self)
     118{
     119    return INT2NUM(caca_wherey(_SELF));
     120}
    114121
    115122simple_func(clear_canvas)
     
    586593
    587594    rb_define_method(cCanvas, "gotoxy", gotoxy, 2);
    588     rb_define_method(cCanvas, "cursor_x", get_cursor_x, 0);
    589     rb_define_method(cCanvas, "cursor_y", get_cursor_y, 0);
     595    rb_define_method(cCanvas, "wherex", wherex, 0);
     596    rb_define_method(cCanvas, "wherey", wherey, 0);
    590597    rb_define_method(cCanvas, "handle_x", get_canvas_handle_x, 0);
    591598    rb_define_method(cCanvas, "handle_y", get_canvas_handle_y, 0);
  • libcaca/trunk/ruby/ruby-caca.dox

    r3553 r3587  
    3838irb(main):009:0>Caca.constants
    3939=>["BROWN", "BOLD", "GREEN", "LIGHTMAGENTA", "LIGHTBLUE", "BLINK",
    40 "MAGENTA","DEFAULT", "TRANSPARENT", "BLUE", "LIGHTRED", "DARKGRAY",
    41 "UNDERLINE","RED", "WHITE", "BLACK", "LIGHTCYAN", "LIGHTGRAY",
    42 "ITALICS","CYAN", "YELLOW", "LIGHTGREEN", "Canvas", "Dither", "Font"]
     40"MAGENTA", "DEFAULT", "TRANSPARENT", "BLUE", "LIGHTRED", "DARKGRAY",
     41"UNDERLINE", "RED", "WHITE", "BLACK", "LIGHTCYAN", "LIGHTGRAY",
     42"ITALICS", "CYAN", "YELLOW", "LIGHTGREEN", "Canvas", "Dither", "Font"]
    4343\endcode
    4444
     
    5555\code
    5656irb(main):012:0>Caca::Canvas.my_instance_methods
    57 =>["attr=", "blit", "clear", "create_frame", "cursor_x", "cursor_y",
    58 "dither_bitmap","draw_box", "draw_circle", "draw_cp437_box", "draw_ellipse",
    59 "draw_line","draw_polyline", "draw_thin_box", "draw_thin_ellipse",
    60 "draw_thin_line","draw_thin_polyline", "draw_thin_triangle",
    61 "draw_triangle","export_to_memory", "fill_box", "fill_ellipse",
    62 "fill_triangle","flip", "flop", "frame=", "frame_count", "frame_name",
    63 "frame_name=","free_frame", "get_attr", "get_char", "gotoxy",
    64 "handle_x","handle_y", "height", "height=", "import_file",
    65 "import_from_memory","invert", "printf", "put_attr", "put_char", "put_str",
    66 "rotate_180","rotate_left", "rotate_right", "set_attr",
    67 "set_boundaries","set_color_ansi", "set_color_argb", "set_frame",
    68 "set_frame_name","set_handle", "set_height", "set_size", "set_width",
    69 "stretch_left","stretch_right", "width", "width="]
     57=>["attr=", "blit", "clear", "create_frame",
     58"dither_bitmap", "draw_box", "draw_circle", "draw_cp437_box", "draw_ellipse",
     59"draw_line", "draw_polyline", "draw_thin_box", "draw_thin_ellipse",
     60"draw_thin_line", "draw_thin_polyline", "draw_thin_triangle",
     61"draw_triangle", "export_to_memory", "fill_box", "fill_ellipse",
     62"fill_triangle", "flip", "flop", "frame=", "frame_count", "frame_name",
     63"frame_name=", "free_frame", "get_attr", "get_char", "gotoxy",
     64"handle_x", "handle_y", "height", "height=", "import_file",
     65"import_from_memory", "invert", "printf", "put_attr", "put_char", "put_str",
     66"rotate_180", "rotate_left", "rotate_right", "set_attr",
     67"set_boundaries", "set_color_ansi", "set_color_argb", "set_frame",
     68"set_frame_name", "set_handle", "set_height", "set_size", "set_width",
     69"stretch_left", "stretch_right", "wherex", "wherey", "width", "width="]
    7070\endcode
    7171
     
    8383irb(main):015:0>Caca::Dither.my_instance_methods
    8484=>["algorithm=", "algorithm_list", "antialias=", "antialias_list",
    85 "brightness=","charset=", "charset_list", "color=", "color_list",
    86 "contrast=","gamma=", "palette=", "set_algorithm", "set_antialias",
    87 "set_brightness","set_charset", "set_color", "set_contrast",
    88 "set_gamma","set_palette"]
     85"brightness=", "charset=", "charset_list", "color=", "color_list",
     86"contrast=", "gamma=", "palette=", "set_algorithm", "set_antialias",
     87"set_brightness", "set_charset", "set_color", "set_contrast",
     88"set_gamma", "set_palette"]
    8989\endcode
    9090
     
    9292irb(main):010:0>Caca::Display.my_instance_methods
    9393=>["canvas", "get_event", "height", "mouse=", "mouse_x", "mouse_y", "refresh",
    94 "set_mouse","set_time", "set_title", "time", "time=", "title=", "width"]
     94"set_mouse", "set_time", "set_title", "time", "time=", "title=", "width"]
    9595\endcode
    9696
     
    141141\code
    142142$ruby -rcaca -e 'p Caca::Canvas.export_list'
    143 [["caca","native libcaca format"], ["ansi", "ANSI"], ["utf8", "UTF-8
     143[["caca", "native libcaca format"], ["ansi", "ANSI"], ["utf8", "UTF-8
    144144withANSI escape codes"], ["utf8cr", "UTF-8 with ANSI escape codes and
    145145MS-DOS\\r"], ["html", "HTML"], ["html3", "backwards-compatible HTML"],
    146 ["irc","IRC with mIRC colours"], ["ps", "PostScript document"], ["svg",
     146["irc", "IRC with mIRC colours"], ["ps", "PostScript document"], ["svg",
    147147"SVGvector image"], ["tga", "TGA image"]]
    148148\endcode
  • libcaca/trunk/ruby/t/tc_canvas.rb

    r3511 r3587  
    3232    def test_cursor
    3333        @c.gotoxy(1,1)
    34         assert_equal(1, @c.cursor_x)
    35         assert_equal(1, @c.cursor_y)
     34        assert_equal(1, @c.wherex)
     35        assert_equal(1, @c.wherey)
    3636    end
    3737    def test_clear
Note: See TracChangeset for help on using the changeset viewer.